(void)fclose(fp);
} else {
warn("%s", *argv);
- eval = 1;
+ eval = EXIT_FAILURE;
}
if (!entries)
else
r_columnate();
if (ferror(stdout) || fclose(stdout))
- eval = 1;
+ eval = EXIT_FAILURE;
exit(eval);
}
* sizeof(wchar_t *))) ||
!(lens = realloc(lens, ((u_int)maxcols + DEFCOLS)
* sizeof(int))))
- err(1, NULL);
+ err(EXIT_FAILURE, _("out of memory?"));
memset((char *)lens + maxcols * sizeof(int),
0, DEFCOLS * sizeof(int));
maxcols += DEFCOLS;
FILE *fp;
{
static int maxentry;
- int len;
+ int len, lineno = 1, reportedline = 0;
wchar_t *p, buf[MAXLINELEN];
if (!list)
if (!*p)
continue;
if (!(p = wcschr(p, '\n')) && !feof(fp)) {
- warnx(_("line too long"));
- eval = 1;
+ if (reportedline < lineno) {
+ warnx(_("line %d is too long, output will be truncated"), lineno);
+ reportedline = lineno;
+ }
+ eval = EXIT_FAILURE;
continue;
}
+ lineno++;
if (!feof(fp))
*p = '\0';
len = wcs_width(buf); /* len = p - buf; */
maxentry += DEFNUM;
if (!(list = realloc(list,
(u_int)maxentry * sizeof(wchar_t *))))
- err(1, NULL);
+ err(EXIT_FAILURE, _("out of memory?"));
}
list[entries++] = wcsdup(buf);
}
char *p;
if (!(p = malloc(size)))
- err(1, NULL);
+ err(EXIT_FAILURE, _("out of memory?"));
memset(p, 0, size);
return (p);
}