paste: delimiter list use should restart for each new output line
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
This commit is contained in:
@@ -36,11 +36,12 @@ static void paste_files(FILE** files, int file_cnt, char* delims, int del_cnt)
|
|||||||
{
|
{
|
||||||
char *line;
|
char *line;
|
||||||
char delim;
|
char delim;
|
||||||
int del_idx = 0;
|
|
||||||
int active_files = file_cnt;
|
int active_files = file_cnt;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
while (active_files > 0) {
|
while (active_files > 0) {
|
||||||
|
int del_idx = 0;
|
||||||
|
|
||||||
for (i = 0; i < file_cnt; ++i) {
|
for (i = 0; i < file_cnt; ++i) {
|
||||||
if (files[i] == NULL)
|
if (files[i] == NULL)
|
||||||
continue;
|
continue;
|
||||||
@@ -70,10 +71,11 @@ static void paste_files_separate(FILE** files, char* delims, int del_cnt)
|
|||||||
{
|
{
|
||||||
char *line, *next_line;
|
char *line, *next_line;
|
||||||
char delim;
|
char delim;
|
||||||
int del_idx = 0;
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; files[i]; ++i) {
|
for (i = 0; files[i]; ++i) {
|
||||||
|
int del_idx = 0;
|
||||||
|
|
||||||
line = NULL;
|
line = NULL;
|
||||||
while ((next_line = xmalloc_fgetline(files[i])) != NULL) {
|
while ((next_line = xmalloc_fgetline(files[i])) != NULL) {
|
||||||
if (line) {
|
if (line) {
|
||||||
|
Reference in New Issue
Block a user