Changes in uspace/app/nettest1/nettest1.c [d4d74dc:a2e3ee6] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nettest1/nettest1.c
rd4d74dc ra2e3ee6 46 46 #include <arg_parse.h> 47 47 48 #include <inet/dnsr.h> 48 49 #include <net/in.h> 49 50 #include <net/in6.h> … … 75 76 printf( 76 77 "Network Networking test 1 aplication - sockets\n" 77 "Usage: echo [options] numeric_address\n"78 "Usage: nettest1 [options] host\n" 78 79 "Where options are:\n" 79 80 "-f protocol_family | --family=protocol_family\n" … … 290 291 struct sockaddr_in address_in; 291 292 struct sockaddr_in6 address_in6; 293 dnsr_hostinfo_t *hinfo; 292 294 uint8_t *address_start; 293 295 … … 319 321 } 320 322 321 /* If not before the last argument containing the address*/323 /* If not before the last argument containing the host */ 322 324 if (index >= argc) { 323 printf("Command line error: missing address\n");325 printf("Command line error: missing host name\n"); 324 326 nettest1_print_help(); 325 327 return EINVAL; … … 348 350 } 349 351 350 /* Parse the last argument which should contain the address */352 /* Parse the last argument which should contain the host/address */ 351 353 rc = inet_pton(family, argv[argc - 1], address_start); 352 354 if (rc != EOK) { 353 fprintf(stderr, "Address parse error %d\n", rc); 354 return rc; 355 /* Try interpreting as a host name */ 356 rc = dnsr_name2host(argv[argc - 1], &hinfo); 357 if (rc != EOK) { 358 printf("Error resolving host '%s'.\n", argv[argc - 1]); 359 return rc; 360 } 361 362 rc = inet_addr_sockaddr_in(&hinfo->addr, &address_in); 363 if (rc != EOK) { 364 printf("Host '%s' not resolved as IPv4 address.\n", argv[argc - 1]); 365 return rc; 366 } 355 367 } 356 368
Note:
See TracChangeset
for help on using the changeset viewer.