summaryrefslogtreecommitdiffstats
path: root/usr.sbin/lpr
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-05-13 20:52:31 +0000
committerbrian <brian@FreeBSD.org>1997-05-13 20:52:31 +0000
commitdc36a1d5ad68922d4425cce4fb05d82a4584ec17 (patch)
tree7c9249b99bc8e2d005ac2f6330defdcb7df676c6 /usr.sbin/lpr
parente3f3db531cbaefb5771f00cb17a68febda27a649 (diff)
downloadFreeBSD-src-dc36a1d5ad68922d4425cce4fb05d82a4584ec17.zip
FreeBSD-src-dc36a1d5ad68922d4425cce4fb05d82a4584ec17.tar.gz
Don't output extraneous tab
Submitted by: Garance A Drosehn <gad@eclipse.its.rpi.edu>
Diffstat (limited to 'usr.sbin/lpr')
-rw-r--r--usr.sbin/lpr/lpc/cmds.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/usr.sbin/lpr/lpc/cmds.c b/usr.sbin/lpr/lpc/cmds.c
index 51e269e..95e46ba 100644
--- a/usr.sbin/lpr/lpc/cmds.c
+++ b/usr.sbin/lpr/lpc/cmds.c
@@ -821,13 +821,17 @@ prstat()
return;
}
(void) close(fd);
- putchar('\t');
+ /* print out the contents of the status file, if it exists */
(void) sprintf(line, "%s/%s", SD, ST);
fd = open(line, O_RDONLY);
if (fd >= 0) {
(void) flock(fd, LOCK_SH);
- while ((i = read(fd, line, sizeof(line))) > 0)
- (void) fwrite(line, 1, i, stdout);
+ (void) fstat(fd, &stbuf);
+ if (stbuf.st_size > 0) {
+ putchar('\t');
+ while ((i = read(fd, line, sizeof(line))) > 0)
+ (void) fwrite(line, 1, i, stdout);
+ }
(void) close(fd); /* unlocks as well */
}
}
OpenPOWER on IntegriCloud