Changeset 330df83 in mainline for uspace/app
- Timestamp:
- 2013-07-19T20:42:57Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- f4cbf9dd
- Parents:
- 8a8a08d1 (diff), cd18cd1 (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. - Location:
- uspace/app
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r8a8a08d1 r330df83 63 63 static bool should_quit = false; 64 64 static bool dash_represents_stdin = false; 65 static unsigned int lineno = 0; 66 static bool number = false; 67 static bool last_char_was_newline = false; 65 68 66 69 static console_ctrl_t *console = NULL; … … 75 78 { "hex", no_argument, 0, 'x' }, 76 79 { "stdin", no_argument, 0, 's' }, 80 { "number", no_argument, 0, 'n' }, 77 81 { 0, 0, 0, 0 } 78 82 }; … … 95 99 " -m, --more Pause after each screen full\n" 96 100 " -x, --hex Print bytes as hex values\n" 97 " -s --stdin Treat `-' in file list as standard input\n" 101 " -s, --stdin Treat `-' in file list as standard input\n" 102 " -n, --number Number all output lines\n" 98 103 "Currently, %s is under development, some options don't work.\n", 99 104 cmdname, cmdname); … … 153 158 static void paged_char(wchar_t c) 154 159 { 160 if (last_char_was_newline && number) { 161 lineno++; 162 printf("%6u ", lineno); 163 } 155 164 putchar(c); 165 last_char_was_newline = c == '\n'; 156 166 if (paging_enabled) { 157 167 chars_remaining--; … … 306 316 should_quit = false; 307 317 console = console_init(stdin, stdout); 318 number = false; 319 lineno = 0; 320 /* This enables printing of the first number. */ 321 last_char_was_newline = true; 322 308 323 309 324 argc = cli_count_args(argv); 310 325 311 326 for (c = 0, optind = 0, opt_ind = 0; c != -1;) { 312 c = getopt_long(argc, argv, "xhvmH:t:b:s ", long_options, &opt_ind);327 c = getopt_long(argc, argv, "xhvmH:t:b:s:n", long_options, &opt_ind); 313 328 switch (c) { 314 329 case 'h': … … 347 362 dash_represents_stdin = true; 348 363 break; 364 case 'n': 365 number = true; 366 break; 349 367 } 350 368 } -
uspace/app/dnsres/dnsres.c
r8a8a08d1 r330df83 36 36 #include <inet/addr.h> 37 37 #include <inet/dnsr.h> 38 #include <net/socket_codes.h> 38 39 #include <stdio.h> 39 40 #include <stdlib.h> 40 41 41 #define NAME "dnsres"42 #define NAME "dnsres" 42 43 43 44 static void print_syntax(void) 44 45 { 45 printf(" syntax: " NAME " <host-name>\n");46 printf("Syntax: %s [-4|-6] <host-name>\n", NAME); 46 47 } 47 48 48 49 int main(int argc, char *argv[]) 49 50 { 50 int rc; 51 dnsr_hostinfo_t *hinfo; 52 char *hname; 53 char *saddr; 54 55 if (argc != 2) { 51 if ((argc < 2) || (argc > 3)) { 56 52 print_syntax(); 57 53 return 1; 58 54 } 59 60 hname = argv[1]; 61 62 rc = dnsr_name2host(hname, &hinfo); 55 56 uint16_t af; 57 char *hname; 58 59 if (str_cmp(argv[1], "-4") == 0) { 60 if (argc < 3) { 61 print_syntax(); 62 return 1; 63 } 64 65 af = AF_INET; 66 hname = argv[2]; 67 } else if (str_cmp(argv[1], "-6") == 0) { 68 if (argc < 3) { 69 print_syntax(); 70 return 1; 71 } 72 73 af = AF_INET6; 74 hname = argv[2]; 75 } else { 76 af = 0; 77 hname = argv[1]; 78 } 79 80 dnsr_hostinfo_t *hinfo; 81 int rc = dnsr_name2host(hname, &hinfo, af); 63 82 if (rc != EOK) { 64 printf( NAME ": Error resolving '%s'.\n", argv[1]);65 return 1;83 printf("%s: Error resolving '%s'.\n", NAME, hname); 84 return rc; 66 85 } 67 86 87 char *saddr; 68 88 rc = inet_addr_format(&hinfo->addr, &saddr); 69 89 if (rc != EOK) { 70 90 dnsr_hostinfo_destroy(hinfo); 71 printf( NAME ": Out of memory.\n");72 return 1;91 printf("%s: Error formatting address.\n", NAME); 92 return rc; 73 93 } 74 94 75 95 printf("Host name: %s\n", hname); 96 76 97 if (str_cmp(hname, hinfo->cname) != 0) 77 98 printf("Canonical name: %s\n", hinfo->cname); 99 78 100 printf("Address: %s\n", saddr); 79 101 80 102 dnsr_hostinfo_destroy(hinfo); 81 103 free(saddr); 82 104 83 105 return 0; 84 106 } -
uspace/app/nettest1/nettest1.c
r8a8a08d1 r330df83 335 335 /* Interpret as a host name */ 336 336 dnsr_hostinfo_t *hinfo = NULL; 337 rc = dnsr_name2host(addr_s, &hinfo );337 rc = dnsr_name2host(addr_s, &hinfo, family); 338 338 339 339 if (rc != EOK) { -
uspace/app/nettest2/nettest2.c
r8a8a08d1 r330df83 271 271 /* Interpret as a host name */ 272 272 dnsr_hostinfo_t *hinfo = NULL; 273 rc = dnsr_name2host(addr_s, &hinfo );273 rc = dnsr_name2host(addr_s, &hinfo, family); 274 274 275 275 if (rc != EOK) { -
uspace/app/nettest3/nettest3.c
r8a8a08d1 r330df83 78 78 if (rc != EOK) { 79 79 /* Try interpreting as a host name */ 80 rc = dnsr_name2host(argv[1], &hinfo );80 rc = dnsr_name2host(argv[1], &hinfo, AF_INET); 81 81 if (rc != EOK) { 82 82 printf("Error resolving host '%s'.\n", argv[1]); -
uspace/app/nterm/conn.c
r8a8a08d1 r330df83 84 84 /* Interpret as a host name */ 85 85 dnsr_hostinfo_t *hinfo = NULL; 86 rc = dnsr_name2host(addr_s, &hinfo );86 rc = dnsr_name2host(addr_s, &hinfo, 0); 87 87 88 88 if (rc != EOK) { -
uspace/app/ping/ping.c
r8a8a08d1 r330df83 212 212 if (rc != EOK) { 213 213 /* Try interpreting as a host name */ 214 rc = dnsr_name2host(argv[argi], &hinfo );214 rc = dnsr_name2host(argv[argi], &hinfo, AF_INET); 215 215 if (rc != EOK) { 216 216 printf(NAME ": Error resolving host '%s'.\n", argv[argi]); -
uspace/app/ping6/ping6.c
r8a8a08d1 r330df83 102 102 } 103 103 104 printf("Received ICMP echo reply: from %s to %s, seq. no %u, "104 printf("Received ICMPv6 echo reply: from %s to %s, seq. no %u, " 105 105 "payload size %zu\n", asrc, adest, sdu->seq_no, sdu->size); 106 106 … … 212 212 if (rc != EOK) { 213 213 /* Try interpreting as a host name */ 214 rc = dnsr_name2host(argv[argi], &hinfo );214 rc = dnsr_name2host(argv[argi], &hinfo, AF_INET6); 215 215 if (rc != EOK) { 216 216 printf(NAME ": Error resolving host '%s'.\n", argv[argi]);
Note:
See TracChangeset
for help on using the changeset viewer.