Stop on write error.

This commit is contained in:
Poul-Henning Kamp 2004-09-27 08:24:05 +00:00
parent 2a61444749
commit eb7b5f46a3
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=135852

View File

@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$");
#include <stdlib.h>
#include <stdio.h>
#include <err.h>
/*
* lptest -- line printer test program (and other devices).
@ -75,11 +76,13 @@ main(int argc, char **argv)
fc = ' ';
nc = fc;
for (j = 0; j < len; j++) {
putchar(nc);
if (putchar(nc) == EOF)
err(1, "Write error");
if (++nc == 0177)
nc = ' ';
}
putchar('\n');
if (putchar('\n') == EOF)
err(1, "Write error");
}
(void) fflush(stdout);
exit(0);