Print @var{str} between adjacent output columns,
rather than the default of a single TAB character.
-The delimiter @var{str} may not be empty.
+The delimiter @var{str} may be empty, in which case
+the ASCII NUL character is used to delimit output columns.
@item --total
Output a summary at the end.
char buf1[INT_BUFSIZE_BOUND (uintmax_t)];
char buf2[INT_BUFSIZE_BOUND (uintmax_t)];
char buf3[INT_BUFSIZE_BOUND (uintmax_t)];
- printf ("%s%s%s%s%s%s%s%c",
- umaxtostr (total[0], buf1), col_sep,
- umaxtostr (total[1], buf2), col_sep,
- umaxtostr (total[2], buf3), col_sep,
- _("total"), delim);
+ if (col_sep_len == 1)
+ { /* Separate to handle NUL char. */
+ printf ("%s%c%s%c%s%c%s%c",
+ umaxtostr (total[0], buf1), *col_sep,
+ umaxtostr (total[1], buf2), *col_sep,
+ umaxtostr (total[2], buf3), *col_sep,
+ _("total"), delim);
+ }
+ else
+ {
+ printf ("%s%s%s%s%s%s%s%c",
+ umaxtostr (total[0], buf1), col_sep,
+ umaxtostr (total[1], buf2), col_sep,
+ umaxtostr (total[2], buf3), col_sep,
+ _("total"), delim);
+ }
}
if (issued_disorder_warning[0] || issued_disorder_warning[1])
{OUT=>"1\n\0002\n\0002\n\000\0003\n\000\0003\n\000\0003\n"} ],
['zdelim-empty', '-z', '-z --output-delimiter=', @zinputs,
{OUT=>"1\000\0002\000\0002\000\000\0003\000\000\0003\000\000\0003\000"} ],
+ ['total-delim-empty', '--total --output-delimiter=', @inputs,
+ {OUT=>"1\n\0002\n\0002\n\000\0003\n\000\0003\n\000\0003\n"
+ . "1\0002\0003\000total\n"} ],
# invalid dual delimiter
['delim-dual', '--output-delimiter=,', '--output-delimiter=+', @inputs,