about summary refs log tree commit diff
path: root/sunrpc/tst-getmyaddr.c
blob: 1eaf9b22cafa3df473c30e96a52ef728f36f4dd5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#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"