diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-14 10:47:18 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-14 10:47:18 +0200 |
commit | 75e90b15482184db83f03c67b53d4220888c6c9d (patch) | |
tree | 8307ba71f584715fcad8beb4373f9318e1f9ec13 /coreutils/nl.c | |
parent | cc86b2ad965bff071185edbb77b5a6ea45023e43 (diff) | |
download | busybox-w32-75e90b15482184db83f03c67b53d4220888c6c9d.tar.gz busybox-w32-75e90b15482184db83f03c67b53d4220888c6c9d.tar.bz2 busybox-w32-75e90b15482184db83f03c67b53d4220888c6c9d.zip |
cat: fix "cat -An" ignoring -n; make numbering go througn all files
function old new delta
cat_main 418 428 +10
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils/nl.c')
-rw-r--r-- | coreutils/nl.c | 20 |
1 files changed, 0 insertions, 20 deletions
diff --git a/coreutils/nl.c b/coreutils/nl.c index 5c64923bb..dc468a90b 100644 --- a/coreutils/nl.c +++ b/coreutils/nl.c | |||
@@ -35,26 +35,6 @@ | |||
35 | 35 | ||
36 | #include "libbb.h" | 36 | #include "libbb.h" |
37 | 37 | ||
38 | void FAST_FUNC print_numbered_lines(struct number_state *ns, const char *filename) | ||
39 | { | ||
40 | FILE *fp = fopen_or_warn_stdin(filename); | ||
41 | unsigned N = ns->start; | ||
42 | char *line; | ||
43 | |||
44 | while ((line = xmalloc_fgetline(fp)) != NULL) { | ||
45 | if (ns->all | ||
46 | || (ns->nonempty && line[0]) | ||
47 | ) { | ||
48 | printf("%*u%s%s\n", ns->width, N, ns->sep, line); | ||
49 | N += ns->inc; | ||
50 | } else if (ns->empty_str) | ||
51 | fputs(ns->empty_str, stdout); | ||
52 | free(line); | ||
53 | } | ||
54 | |||
55 | fclose(fp); | ||
56 | } | ||
57 | |||
58 | int nl_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 38 | int nl_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
59 | int nl_main(int argc UNUSED_PARAM, char **argv) | 39 | int nl_main(int argc UNUSED_PARAM, char **argv) |
60 | { | 40 | { |