simple gethostbyname test case

svn path=/trunk/; revision=11792
This commit is contained in:
Art Yerkes 2004-11-24 04:08:44 +00:00
parent a0811f8010
commit d1ad9c04ee
2 changed files with 43 additions and 0 deletions

View file

@ -0,0 +1,21 @@
#include <stdio.h>
#include <winsock2.h>
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;
}

View file

@ -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