summaryrefslogtreecommitdiff
path: root/contrib/FAQ/code/printcap01/hpf.c
diff options
context:
space:
mode:
authorsvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
committersvn2git <svn2git@FreeBSD.org>1994-07-01 08:00:00 +0000
commit5e0e9b99dc3fc0ecd49d929db0d57c784b66f481 (patch)
treee779b5a6edddbb949b7990751b12d6f25304ba86 /contrib/FAQ/code/printcap01/hpf.c
parenta16f65c7d117419bd266c28a1901ef129a337569 (diff)
Diffstat (limited to 'contrib/FAQ/code/printcap01/hpf.c')
-rw-r--r--contrib/FAQ/code/printcap01/hpf.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/contrib/FAQ/code/printcap01/hpf.c b/contrib/FAQ/code/printcap01/hpf.c
new file mode 100644
index 0000000000000..8d78c092f902f
--- /dev/null
+++ b/contrib/FAQ/code/printcap01/hpf.c
@@ -0,0 +1,38 @@
+/*
+source to my hp filter, installed as /usr/libexec/lpr/hpf:
+*/
+#include "stdio.h"
+#include <signal.h>
+#include <sys/file.h>
+#include <sys/ioctl.h>
+#include <sgtty.h>
+
+main(ac, av)
+int ac;
+char **av;
+{
+ int c;
+ struct sgttyb nbuf;
+ unsigned long lbits;
+
+ setbuf(stdout, NULL);
+ lbits = LDECCTQ | LPASS8 | LLITOUT;
+ ioctl(fileno(stdout), TIOCLSET, &lbits);
+ ioctl(fileno(stdout), TIOCGETP, &nbuf);
+ nbuf.sg_flags &= ~(ECHO | XTABS | CRMOD);
+ ioctl(fileno(stdout), TIOCSETP, &nbuf);
+
+ fputs("\033E\033&k2G", stdout);
+
+ while (1) {
+ if ((c = getchar()) != EOF) {
+ putchar(c);
+ } else {
+ break;
+ }
+ }
+
+ fputs("\033&l0H", stdout);
+
+ exit(0);
+}