Back to index

glibc  2.9
tst-getmyaddr.c
Go to the documentation of this file.
00001 #include <stdio.h>
00002 #include <string.h>
00003 #include <arpa/inet.h>
00004 #include <netinet/in.h>
00005 #include <rpc/clnt.h>
00006 
00007 
00008 static int
00009 do_test (void)
00010 {
00011   struct sockaddr_in ad;
00012   struct sockaddr_in ad2;
00013   memset (&ad, '\0', sizeof (ad));
00014   memset (&ad2, '\0', sizeof (ad2));
00015 
00016   get_myaddress (&ad);
00017 
00018   printf ("addr = %s:%d\n", inet_ntoa (ad.sin_addr), ad.sin_port);
00019 
00020   return memcmp (&ad, &ad2, sizeof (ad)) == 0;
00021 }
00022 
00023 #define TEST_FUNCTION do_test ()
00024 #include "../test-skeleton.c"