ReactOS 0.4.15-dev-8614-gbc76250
gethostbyname.c File Reference
#include <stdio.h>
#include <winsock2.h>
Include dependency graph for gethostbyname.c:

Go to the source code of this file.

Functions

int main (int argc, char **argv)
 

Function Documentation

◆ main()

int main ( int argc  ,
char **  argv 
)

Definition at line 4 of file gethostbyname.c.

4 {
5 WSADATA wdata;
6
7 WSAStartup( 0x0101, &wdata );
8
9 if( argc > 1 ) {
10 struct hostent *he = gethostbyname( argv[1] );
11 if( !he ) {
12 printf( "lookup of host %s failed: %d\n", argv[1], WSAGetLastError() );
13 return 1;
14 } else {
15 printf( "Lookup of host %s returned %s\n",
16 argv[1], inet_ntoa(*((struct in_addr *)he->h_addr_list[0])) );
17 return 0;
18 }
19 } else
20 return 1;
21}
static int argc
Definition: ServiceArgs.c:12
INT WINAPI WSAStartup(IN WORD wVersionRequested, OUT LPWSADATA lpWSAData)
Definition: startup.c:113
#define printf
Definition: freeldr.h:97
PHOSTENT WSAAPI gethostbyname(IN const char FAR *name)
Definition: getxbyxx.c:221
#define inet_ntoa(addr)
Definition: inet.h:100
#define argv
Definition: mplay32.c:18
char ** h_addr_list
Definition: winsock.h:138
Definition: tcpip.h:126
int PASCAL FAR WSAGetLastError(void)
Definition: dllmain.c:112