summaryrefslogtreecommitdiff
path: root/tests/port/test_gai_strerror_r.c
diff options
context:
space:
mode:
authorAndreas Baumann <abaumann@yahoo.com>2009-04-01 15:48:39 +0200
committerAndreas Baumann <abaumann@yahoo.com>2009-04-01 15:48:39 +0200
commit8caf15e38c6c1a803c110028b0d8a10d6fece776 (patch)
treedcc3b99e2e716ce17172b94c2f7adc5ca3d522eb /tests/port/test_gai_strerror_r.c
parentdde2d0138dd3d6d603b476f7e5f50aff2270251e (diff)
downloadwolfbones-8caf15e38c6c1a803c110028b0d8a10d6fece776.tar.gz
wolfbones-8caf15e38c6c1a803c110028b0d8a10d6fece776.tar.bz2
removed extern in function prototypes; added gai_strerror_r and a test, cleanup in netdb.h and netdb.c
Diffstat (limited to 'tests/port/test_gai_strerror_r.c')
-rw-r--r--tests/port/test_gai_strerror_r.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/port/test_gai_strerror_r.c b/tests/port/test_gai_strerror_r.c
new file mode 100644
index 0000000..eb4c249
--- /dev/null
+++ b/tests/port/test_gai_strerror_r.c
@@ -0,0 +1,28 @@
+#include "port/sys.h"
+
+#define TEST_GAI_STRERROR_R
+#include "port/netdb.c" /* for gai_strerror_r */
+
+#include <stdlib.h> /* for exit, EXIT_SUCCESS, free */
+#include <stdio.h> /* for printf */
+
+int main( void ) {
+ signed int i;
+ int res;
+ char buf[1024];
+
+ /* go through gai errors (TODO: find out how many of them there are!) */
+ for( i = -1; i >= -255; i-- ) {
+ *buf = '\0';
+ res = gai_strerror_r( i, buf, 1024 );
+ printf( "%d: %d \"%s\"\n", i, res, buf );
+ }
+
+ /* go through gai errors (TODO: find out how many of them there are!) */
+ for( i = -1; i >= -255; i-- ) {
+ *buf = '\0';
+ res = wolf_port_gai_strerror_r( i, buf, 1024 );
+ printf( "%d: %d \"%s\"\n", i, res, buf );
+ }
+ exit( EXIT_SUCCESS );
+}