less: "(null)" is a bit strange. "standard input" is better :)

This commit is contained in:
Denis Vlasenko
2006-12-21 13:57:37 +00:00
parent e147a72173
commit d51d14e36f

View File

@ -199,7 +199,15 @@ static void data_readlines(void)
char *current_line, *p; char *current_line, *p;
FILE *fp; FILE *fp;
fp = filename ? xfopen(filename, "r") : stdin; if (filename)
fp = xfopen(filename, "r");
else {
/* "less" with no arguments in argv[] */
fp = stdin;
/* For status line only */
filename = xstrdup(bb_msg_standard_input);
}
flines = NULL; flines = NULL;
if (option_mask32 & FLAG_N) { if (option_mask32 & FLAG_N) {
w -= 6; w -= 6;
@ -229,6 +237,7 @@ static void data_readlines(void)
n++; n++;
goto again; goto again;
} }
last_rem = rem; last_rem = rem;
if (option_mask32 & FLAG_N) { if (option_mask32 & FLAG_N) {
flines[i] = xasprintf((n <= 99999) ? "%5u %s" : "%05u %s", flines[i] = xasprintf((n <= 99999) ? "%5u %s" : "%05u %s",
@ -272,7 +281,7 @@ static void m_status_print(void)
if (line_pos >= num_flines - height + 2) { if (line_pos >= num_flines - height + 2) {
printf("(END)"NORMAL); printf("(END)"NORMAL);
if (num_files > 1 && current_file != num_files) if (num_files > 1 && current_file != num_files)
printf(HIGHLIGHT"- Next: %s "NORMAL, files[current_file]); printf(HIGHLIGHT" - next: %s "NORMAL, files[current_file]);
return; return;
} }
percentage = calc_percent(); percentage = calc_percent();