summaryrefslogtreecommitdiff
path: root/coreutils
diff options
context:
space:
mode:
authorDenys Vlasenko2018-04-29 14:05:43 +0200
committerDenys Vlasenko2018-04-29 14:05:43 +0200
commitd80eecb86812c1fbda652f9b995060c26ba0b155 (patch)
tree90b1282970b7af2e1adcf235702dead15f156bb0 /coreutils
parentbc2e70b4a25e58264cdc236803c32f5a9a0c7e4c (diff)
downloadbusybox-d80eecb86812c1fbda652f9b995060c26ba0b155.zip
busybox-d80eecb86812c1fbda652f9b995060c26ba0b155.tar.gz
cat: fix cat -e and cat -v erroneously numbering 1st line
function old new delta cat_main 418 421 +3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r--coreutils/cat.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 5f02233..fb735f9 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -112,10 +112,10 @@ static int catv(unsigned opts, char **argv)
int retval = EXIT_SUCCESS;
int fd;
#if ENABLE_FEATURE_CATN
- unsigned lineno = 0;
- unsigned eol_char = (opts & (CAT_OPT_n|CAT_OPT_b)) ? '\n' : 0x100;
+ bool eol_seen = (opts & (CAT_OPT_n|CAT_OPT_b));
+ unsigned eol_char = (eol_seen ? '\n' : 0x100);
unsigned skip_num_on = (opts & CAT_OPT_b) ? '\n' : 0x100;
- bool eol_seen = 1;
+ unsigned lineno = 0;
#endif
BUILD_BUG_ON(CAT_OPT_e != VISIBLE_ENDLINE);