Use setvbuf instead of setlinebuf (not supported by HP-UX)

This commit is contained in:
hjp 2012-12-12 17:10:50 +00:00
parent abf8fdc9ba
commit 126d734171
1 changed files with 2 additions and 2 deletions

View File

@ -48,7 +48,7 @@ int main(int argc, char **argv) {
}
if (!filepat) {
fp = stdout;
setlinebuf(fp);
setvbuf(fp, NULL, _IOLBF, BUFSIZ);
}
while ((c = getchar()) != EOF) {
if (print_ts) {
@ -69,7 +69,7 @@ int main(int argc, char **argv) {
fprintf(stderr, "%s: cannot open %s: %s\n", argv[0], file, strerror(errno));
exit(1);
}
setlinebuf(fp);
setvbuf(fp, NULL, _IOLBF, BUFSIZ);
strcpy(lastfile, file);
}
}