diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-03-23 17:58:32 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-03-23 17:58:32 +0100 |
commit | f4a670a9110426e9153e7d5f6e7b7d1f1eac6195 (patch) | |
tree | 23087c739dfae9c35fdfb8f51e84a08d404b4d90 /coreutils | |
parent | f1db95abfbe3621241d1f797d312d7b0981fbac9 (diff) | |
download | busybox-w32-f4a670a9110426e9153e7d5f6e7b7d1f1eac6195.tar.gz busybox-w32-f4a670a9110426e9153e7d5f6e7b7d1f1eac6195.tar.bz2 busybox-w32-f4a670a9110426e9153e7d5f6e7b7d1f1eac6195.zip |
paste: delimiter list use should restart for each new output line
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
-rw-r--r-- | coreutils/paste.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/coreutils/paste.c b/coreutils/paste.c index 54e15c9a0..d929d6aa0 100644 --- a/coreutils/paste.c +++ b/coreutils/paste.c | |||
@@ -36,11 +36,12 @@ static void paste_files(FILE** files, int file_cnt, char* delims, int del_cnt) | |||
36 | { | 36 | { |
37 | char *line; | 37 | char *line; |
38 | char delim; | 38 | char delim; |
39 | int del_idx = 0; | ||
40 | int active_files = file_cnt; | 39 | int active_files = file_cnt; |
41 | int i; | 40 | int i; |
42 | 41 | ||
43 | while (active_files > 0) { | 42 | while (active_files > 0) { |
43 | int del_idx = 0; | ||
44 | |||
44 | for (i = 0; i < file_cnt; ++i) { | 45 | for (i = 0; i < file_cnt; ++i) { |
45 | if (files[i] == NULL) | 46 | if (files[i] == NULL) |
46 | continue; | 47 | continue; |
@@ -70,10 +71,11 @@ static void paste_files_separate(FILE** files, char* delims, int del_cnt) | |||
70 | { | 71 | { |
71 | char *line, *next_line; | 72 | char *line, *next_line; |
72 | char delim; | 73 | char delim; |
73 | int del_idx = 0; | ||
74 | int i; | 74 | int i; |
75 | 75 | ||
76 | for (i = 0; files[i]; ++i) { | 76 | for (i = 0; files[i]; ++i) { |
77 | int del_idx = 0; | ||
78 | |||
77 | line = NULL; | 79 | line = NULL; |
78 | while ((next_line = xmalloc_fgetline(files[i])) != NULL) { | 80 | while ((next_line = xmalloc_fgetline(files[i])) != NULL) { |
79 | if (line) { | 81 | if (line) { |