summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorimp <imp@openbsd.org>1996-08-10 04:41:00 +0000
committerimp <imp@openbsd.org>1996-08-10 04:41:00 +0000
commit475546ba3ddf73b332efd22780f3e817eee3c6e9 (patch)
tree5f134424c0ffbc20d00ee3cc36fdcfcd3114e183
parentidle cleanup (diff)
downloadwireguard-openbsd-475546ba3ddf73b332efd22780f3e817eee3c6e9.tar.xz
wireguard-openbsd-475546ba3ddf73b332efd22780f3e817eee3c6e9.zip
pr -F would sometimes fail to properly use formfeeds.
-rw-r--r--usr.bin/pr/pr.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/usr.bin/pr/pr.c b/usr.bin/pr/pr.c
index 56d23cf7d03..e50f46efabf 100644
--- a/usr.bin/pr/pr.c
+++ b/usr.bin/pr/pr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: pr.c,v 1.2 1996/06/26 05:37:54 deraadt Exp $ */
+/* $OpenBSD: pr.c,v 1.3 1996/08/10 04:41:00 imp Exp $ */
/*-
* Copyright (c) 1991 Keith Muller.
@@ -45,7 +45,7 @@ static char copyright[] =
#ifndef lint
/* from: static char sccsid[] = "@(#)pr.c 8.1 (Berkeley) 6/6/93"; */
-static char *rcsid = "$OpenBSD: pr.c,v 1.2 1996/06/26 05:37:54 deraadt Exp $";
+static char *rcsid = "$OpenBSD: pr.c,v 1.3 1996/08/10 04:41:00 imp Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -1464,13 +1464,21 @@ prtail(cnt, incomp)
/*
* only pad with no headers when incomplete last line
*/
- if (!incomp)
- return(0);
- if ((dspace && (putchar('\n') == EOF)) ||
- (putchar('\n') == EOF)) {
+ if (incomp &&
+ ((dspace && (putchar('\n') == EOF)) ||
+ (putchar('\n') == EOF))) {
pfail();
return(1);
}
+ /*
+ * but honor the formfeed request
+ */
+ if (formfeed) {
+ if (putchar('\f') == EOF) {
+ pfail();
+ return(1);
+ }
+ }
return(0);
}