From d1ad9c04ee0ae25f47b8d14557ebbe8bb6b29aff Mon Sep 17 00:00:00 2001 From: Art Yerkes Date: Wed, 24 Nov 2004 04:08:44 +0000 Subject: [PATCH] simple gethostbyname test case svn path=/trunk/; revision=11792 --- rosapps/tests/gethostbyname/gethostbyname.c | 21 ++++++++++++++++++++ rosapps/tests/gethostbyname/makefile | 22 +++++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 rosapps/tests/gethostbyname/gethostbyname.c create mode 100644 rosapps/tests/gethostbyname/makefile diff --git a/rosapps/tests/gethostbyname/gethostbyname.c b/rosapps/tests/gethostbyname/gethostbyname.c new file mode 100644 index 00000000000..1f9479fd113 --- /dev/null +++ b/rosapps/tests/gethostbyname/gethostbyname.c @@ -0,0 +1,21 @@ +#include +#include + +int main( int argc, char **argv ) { + WSADATA wdata; + + WSAStartup( 0x0101, &wdata ); + + if( argc > 1 ) { + struct hostent *he = gethostbyname( argv[1] ); + if( !he ) { + printf( "lookup of host %s failed: %d\n", argv[1], WSAGetLastError() ); + return 1; + } else { + printf( "Lookup of host %s returned %s\n", + argv[1], inet_ntoa(*((struct in_addr *)he->h_addr_list[0])) ); + return 0; + } + } else + return 1; +} diff --git a/rosapps/tests/gethostbyname/makefile b/rosapps/tests/gethostbyname/makefile new file mode 100644 index 00000000000..cae7c6ed463 --- /dev/null +++ b/rosapps/tests/gethostbyname/makefile @@ -0,0 +1,22 @@ + +PATH_TO_TOP = ../../../reactos + +TARGET_NORC = yes + +TARGET_TYPE = program + +TARGET_APPTYPE = console + +TARGET_NAME = gethostbyname + +TARGET_SDKLIBS = ws2_32.a kernel32.a + +TARGET_OBJECTS = $(TARGET_NAME).o + +TARGET_CFLAGS = -D__USE_W32API -Wall -Werror -g + +include $(PATH_TO_TOP)/rules.mak + +include $(TOOLS_PATH)/helper.mk + +# EOF