mirror of
https://github.com/reactos/reactos.git
synced 2024-12-25 16:50:57 +00:00
simple gethostbyname test case
svn path=/trunk/; revision=11792
This commit is contained in:
parent
a0811f8010
commit
d1ad9c04ee
2 changed files with 43 additions and 0 deletions
21
rosapps/tests/gethostbyname/gethostbyname.c
Normal file
21
rosapps/tests/gethostbyname/gethostbyname.c
Normal 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;
|
||||
}
|
22
rosapps/tests/gethostbyname/makefile
Normal file
22
rosapps/tests/gethostbyname/makefile
Normal 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
|
Loading…
Reference in a new issue