diff options
| author | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-21 13:57:37 +0000 |
|---|---|---|
| committer | Denis Vlasenko <vda.linux@googlemail.com> | 2006-12-21 13:57:37 +0000 |
| commit | d51d14e36fbc174db3eacd203fd00685dcc02011 (patch) | |
| tree | 6923745cd847d9fc271659f3674f8ae1282f4614 | |
| parent | e147a721736922db9f80f233e56dbd36e6e4a902 (diff) | |
| download | busybox-w32-d51d14e36fbc174db3eacd203fd00685dcc02011.tar.gz busybox-w32-d51d14e36fbc174db3eacd203fd00685dcc02011.tar.bz2 busybox-w32-d51d14e36fbc174db3eacd203fd00685dcc02011.zip | |
less: "(null)" is a bit strange. "standard input" is better :)
| -rw-r--r-- | miscutils/less.c | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/miscutils/less.c b/miscutils/less.c index d56f38df5..174155e95 100644 --- a/miscutils/less.c +++ b/miscutils/less.c | |||
| @@ -199,7 +199,15 @@ static void data_readlines(void) | |||
| 199 | char *current_line, *p; | 199 | char *current_line, *p; |
| 200 | FILE *fp; | 200 | FILE *fp; |
| 201 | 201 | ||
| 202 | fp = filename ? xfopen(filename, "r") : stdin; | 202 | if (filename) |
| 203 | fp = xfopen(filename, "r"); | ||
| 204 | else { | ||
| 205 | /* "less" with no arguments in argv[] */ | ||
| 206 | fp = stdin; | ||
| 207 | /* For status line only */ | ||
| 208 | filename = xstrdup(bb_msg_standard_input); | ||
| 209 | } | ||
| 210 | |||
| 203 | flines = NULL; | 211 | flines = NULL; |
| 204 | if (option_mask32 & FLAG_N) { | 212 | if (option_mask32 & FLAG_N) { |
| 205 | w -= 6; | 213 | w -= 6; |
| @@ -229,6 +237,7 @@ static void data_readlines(void) | |||
| 229 | n++; | 237 | n++; |
| 230 | goto again; | 238 | goto again; |
| 231 | } | 239 | } |
| 240 | |||
| 232 | last_rem = rem; | 241 | last_rem = rem; |
| 233 | if (option_mask32 & FLAG_N) { | 242 | if (option_mask32 & FLAG_N) { |
| 234 | flines[i] = xasprintf((n <= 99999) ? "%5u %s" : "%05u %s", | 243 | flines[i] = xasprintf((n <= 99999) ? "%5u %s" : "%05u %s", |
| @@ -270,9 +279,9 @@ static void m_status_print(void) | |||
| 270 | line_pos + 1, line_pos + height - 1, | 279 | line_pos + 1, line_pos + height - 1, |
| 271 | num_flines + 1); | 280 | num_flines + 1); |
| 272 | if (line_pos >= num_flines - height + 2) { | 281 | if (line_pos >= num_flines - height + 2) { |
| 273 | printf("(END) "NORMAL); | 282 | printf("(END)"NORMAL); |
| 274 | if (num_files > 1 && current_file != num_files) | 283 | if (num_files > 1 && current_file != num_files) |
| 275 | printf(HIGHLIGHT"- Next: %s "NORMAL, files[current_file]); | 284 | printf(HIGHLIGHT" - next: %s "NORMAL, files[current_file]); |
| 276 | return; | 285 | return; |
| 277 | } | 286 | } |
| 278 | percentage = calc_percent(); | 287 | percentage = calc_percent(); |
| @@ -289,7 +298,7 @@ static void medium_status_print(void) | |||
| 289 | if (!line_pos) | 298 | if (!line_pos) |
| 290 | printf(HIGHLIGHT"%s %i%% "NORMAL, filename, percentage); | 299 | printf(HIGHLIGHT"%s %i%% "NORMAL, filename, percentage); |
| 291 | else if (line_pos >= num_flines - height + 2) | 300 | else if (line_pos >= num_flines - height + 2) |
| 292 | print_hilite("(END) "); | 301 | print_hilite("(END)"); |
| 293 | else | 302 | else |
| 294 | printf(HIGHLIGHT"%i%% "NORMAL, percentage); | 303 | printf(HIGHLIGHT"%i%% "NORMAL, percentage); |
| 295 | } | 304 | } |
| @@ -318,7 +327,7 @@ static void status_print(void) | |||
| 318 | putchar(':'); | 327 | putchar(':'); |
| 319 | return; | 328 | return; |
| 320 | } | 329 | } |
| 321 | p = "(END) "; | 330 | p = "(END)"; |
| 322 | if (!line_pos) | 331 | if (!line_pos) |
| 323 | p = filename; | 332 | p = filename; |
| 324 | if (num_files > 1) { | 333 | if (num_files > 1) { |
