Changeset 0845589 in mainline
- Timestamp:
- 2013-07-18T06:16:10Z (11 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 34c1bba
- Parents:
- 1d94e21
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bdsh/cmds/modules/cat/cat.c
r1d94e21 r0845589 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 }
Note:
See TracChangeset
for help on using the changeset viewer.