From 4f21c95d3a51a81fdbda3de46ce38e729f3c7b0b Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Tue, 28 Sep 2004 23:08:14 +0000 Subject: Update. * sunrpc/Makefile (xtests): Add tst-getmyaddr. * sunrpc/tst-getmyaddr.c: New file. --- sunrpc/Makefile | 4 +++- sunrpc/tst-getmyaddr.c | 24 ++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 sunrpc/tst-getmyaddr.c (limited to 'sunrpc') diff --git a/sunrpc/Makefile b/sunrpc/Makefile index 6431324f3e..284e355cc3 100644 --- a/sunrpc/Makefile +++ b/sunrpc/Makefile @@ -1,4 +1,4 @@ -# Copyright (C) 1994-2001, 2002, 2003 Free Software Foundation, Inc. +# Copyright (C) 1994-2001, 2002, 2003, 2004 Free Software Foundation, Inc. # This file is part of the GNU C Library. # The GNU C Library is free software; you can redistribute it and/or @@ -85,6 +85,8 @@ all: # Make this the default target; it will be defined in Rules. include ../Makeconfig +xtests := tst-getmyaddr + ifeq ($(have-thread-library),yes) xtests += thrsvc endif diff --git a/sunrpc/tst-getmyaddr.c b/sunrpc/tst-getmyaddr.c new file mode 100644 index 0000000000..1eaf9b22ca --- /dev/null +++ b/sunrpc/tst-getmyaddr.c @@ -0,0 +1,24 @@ +#include +#include +#include +#include +#include + + +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" -- cgit v1.2.3