Changeset 192565b in mainline for uspace/app/nettest1/nettest1.c
- Timestamp:
- 2013-05-27T13:18:13Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f2c19b0
- Parents:
- d120133 (diff), c90aed4 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/nettest1/nettest1.c
rd120133 r192565b 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 address_in.sin_addr.s_addr = host2uint32_t_be(hinfo->addr.ipv4); 355 363 } 356 364
Note:
See TracChangeset
for help on using the changeset viewer.