diff options
Diffstat (limited to 'tests/port/test_getaddrinfo.c')
-rw-r--r-- | tests/port/test_getaddrinfo.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/tests/port/test_getaddrinfo.c b/tests/port/test_getaddrinfo.c index 5b76c28..24fc19b 100644 --- a/tests/port/test_getaddrinfo.c +++ b/tests/port/test_getaddrinfo.c @@ -23,12 +23,16 @@ #include <stdio.h> /* for fprintf */ #include <string.h> /* for memset */ -int main( void ) { +int main( int argc, char **argv ) { struct addrinfo hints; struct addrinfo *result; struct addrinfo *res; int error; - char port_or_service[10]; + + if( argc != 3 ) { + fputs( "usage: test_getaddrinfo <host> <port>\n", stderr ); + exit( EXIT_FAILURE ); + } #ifdef _WIN32 WSADATA wsa_data; @@ -43,8 +47,7 @@ int main( void ) { hints.ai_protocol = IPPROTO_TCP; /* resolve the domain name into a list of addresses */ - itoa( 80, port_or_service, 10 ); - error = getaddrinfo( "www.yahoo.com", port_or_service, &hints, &result ); + error = getaddrinfo( argv[1], argv[2], &hints, &result ); if( error != 0 ) { fprintf( stderr, "getaddrinfo failed: %s (%d)\n", gai_strerror( error ), error ); |