mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-24 02:03:35 +08:00
4f21c95d3a
* sunrpc/Makefile (xtests): Add tst-getmyaddr. * sunrpc/tst-getmyaddr.c: New file.
25 lines
467 B
C
25 lines
467 B
C
#include <stdio.h>
|
|
#include <string.h>
|
|
#include <arpa/inet.h>
|
|
#include <netinet/in.h>
|
|
#include <rpc/clnt.h>
|
|
|
|
|
|
static int
|
|
do_test (void)
|
|
{
|
|
struct sockaddr_in ad;
|
|
struct sockaddr_in ad2;
|
|
memset (&ad, '\0', sizeof (ad));
|
|
memset (&ad2, '\0', sizeof (ad2));
|
|
|
|
get_myaddress (&ad);
|
|
|
|
printf ("addr = %s:%d\n", inet_ntoa (ad.sin_addr), ad.sin_port);
|
|
|
|
return memcmp (&ad, &ad2, sizeof (ad)) == 0;
|
|
}
|
|
|
|
#define TEST_FUNCTION do_test ()
|
|
#include "../test-skeleton.c"
|