Changeset 1433ecda in mainline for uspace/app/bdsh/cmds/modules/cat/cat.c
- Timestamp:
- 2018-04-04T15:42:37Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 2c4e1cc
- Parents:
- 47b2d7e3
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r47b2d7e3 r1433ecda 88 88 help_cmd_cat(HELP_SHORT); 89 89 printf( 90 "Usage: %s [options] <file1> [file2] [...]\n"91 "Options:\n"92 " -h, --help A short option summary\n"93 " -v, --version Print version information and exit\n"94 " -H, --head ## Print only the first ## bytes\n"95 " -t, --tail ## Print only the last ## bytes\n"96 " -b, --buffer ## Set the read buffer size to ##\n"97 " -m, --more Pause after each screen full\n"98 " -x, --hex Print bytes as hex values\n"99 " -s, --stdin Treat `-' in file list as standard input\n"100 " -n, --number Number all output lines\n"101 "Currently, %s is under development, some options don't work.\n",102 cmdname, cmdname);90 "Usage: %s [options] <file1> [file2] [...]\n" 91 "Options:\n" 92 " -h, --help A short option summary\n" 93 " -v, --version Print version information and exit\n" 94 " -H, --head ## Print only the first ## bytes\n" 95 " -t, --tail ## Print only the last ## bytes\n" 96 " -b, --buffer ## Set the read buffer size to ##\n" 97 " -m, --more Pause after each screen full\n" 98 " -x, --hex Print bytes as hex values\n" 99 " -s, --stdin Treat `-' in file list as standard input\n" 100 " -n, --number Number all output lines\n" 101 "Currently, %s is under development, some options don't work.\n", 102 cmdname, cmdname); 103 103 } 104 104 … … 108 108 static void waitprompt(void) 109 109 { 110 console_set_pos(console, 0, console_rows -1);110 console_set_pos(console, 0, console_rows - 1); 111 111 console_set_color(console, COLOR_WHITE, COLOR_BLUE, 0); 112 112 113 113 printf("ENTER/SPACE/PAGE DOWN - next page, " 114 114 "ESC/Q - quit, C - continue unpaged"); 115 115 fflush(stdout); 116 116 … … 265 265 for (i = 0; i < bytes && !should_quit; i++) { 266 266 if (hex) { 267 paged_char(hexchars[((uint8_t)buff[i])/16]); 268 paged_char(hexchars[((uint8_t)buff[i])%16]); 269 paged_char(((count+i+1) & 0xf) == 0 ? '\n' : ' '); 270 } 271 else { 267 paged_char(hexchars[((uint8_t)buff[i]) / 16]); 268 paged_char(hexchars[((uint8_t)buff[i]) % 16]); 269 paged_char(((count + i + 1) & 0xf) == 0 ? '\n' : ' '); 270 } else { 272 271 wchar_t c = str_decode(buff, &offset, bytes); 273 272 if (c == 0) { … … 353 352 return CMD_SUCCESS; 354 353 case 'H': 355 if (!optarg || str_uint64_t(optarg, NULL, 10, false, &head) != EOK 354 if (!optarg || str_uint64_t(optarg, NULL, 10, false, &head) != EOK) { 356 355 puts("Invalid head size\n"); 357 356 return CMD_FAILURE; … … 359 358 break; 360 359 case 't': 361 if (!optarg || str_uint64_t(optarg, NULL, 10, false, &tail) != EOK 360 if (!optarg || str_uint64_t(optarg, NULL, 10, false, &tail) != EOK) { 362 361 puts("Invalid tail size\n"); 363 362 return CMD_FAILURE; … … 367 366 break; 368 367 case 'b': 369 if (!optarg || str_size_t(optarg, NULL, 10, false, &buffer) != EOK 368 if (!optarg || str_size_t(optarg, NULL, 10, false, &buffer) != EOK) { 370 369 puts("Invalid buffer size\n"); 371 370 return CMD_FAILURE; … … 391 390 if (argc < 1) { 392 391 printf("%s - incorrect number of arguments. Try `%s --help'\n", 393 392 cmdname, cmdname); 394 393 return CMD_FAILURE; 395 394 }
Note:
See TracChangeset
for help on using the changeset viewer.