--- paste.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/paste.c b/paste.c index b0ac761..0159fe0 100644 --- a/paste.c +++ b/paste.c _AT_@ -53,7 +53,8 @@ nextline: for (; efgetrune(&c, dsc[i].fp, dsc[i].name) ;) { for (m = last + 1; m < i; m++) - efputrune(&(delim[m % delimlen]), stdout, "<stdout>"); + if (delim[m % delimlen] != '\0') + efputrune(&(delim[m % delimlen]), stdout, "<stdout>"); last = i; if (c == '\n') { if (i != fdescrlen - 1) _AT_@ -68,7 +69,8 @@ nextline: if (i == fdescrlen - 1) putchar('\n'); else - efputrune(&d, stdout, "<stdout>"); + if (d != '\0') + efputrune(&d, stdout, "<stdout>"); last++; } } _AT_@ -96,7 +98,7 @@ main(int argc, char *argv[]) seq = 1; break; case 'd': - adelim = EARGF(usage()); + adelim = ARGF(); unescape(adelim); break; default: _AT_@ -109,8 +111,12 @@ main(int argc, char *argv[]) /* populate delimiters */ /* TODO: fix libutf to accept sizes */ delim = ereallocarray(NULL, utflen(adelim) + 1, sizeof(*delim)); - if (!(delimlen = utftorunestr(adelim, delim))) + if (*adelim == '\0') { + delimlen = 1; + *delim = '\0'; + } else if (!(delimlen = utftorunestr(adelim, delim))) { usage(); + } /* populate file list */ dsc = ereallocarray(NULL, argc, sizeof(*dsc)); -- 2.25.1Received on Mon Mar 02 2020 - 13:35:37 CET
This archive was generated by hypermail 2.3.0 : Mon Mar 02 2020 - 13:36:40 CET