For the last line of the file lenght of line should be determined
where the EOF is instead of new line. Old output was
$ printf "1 2\n3" | column -t
column: line too long
1 2
which this commit will change to
$ printf "1 2\n3" | column -t
1 2
3
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
for (p = buf; *p && iswspace(*p); ++p);
if (!*p)
continue;
- if (!(p = wcschr(p, '\n'))) {
+ if (!(p = wcschr(p, '\n')) && !feof(fp)) {
warnx(_("line too long"));
eval = 1;
continue;
}
- *p = '\0';
+ if (!feof(fp))
+ *p = '\0';
len = wcs_width(buf); /* len = p - buf; */
if (maxlength < len)
maxlength = len;