freebsd-src/contrib/FAQ/code/printcap01/hpf.c
svn2git 5e0e9b99dc Release FreeBSD 1.1.5.1
This commit was manufactured to restore the state of the 1.1.5.1-RELEASE image.
Releases prior to 5.3-RELEASE are omitting the secure/ and crypto/ subdirs.
1994-07-01 00:00:00 -08:00

38 lines
830 B
C

/*
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);
}