home *** CD-ROM | disk | FTP | other *** search
- /*
- offil, a printcap filter for printing the header page.
-
- Written by Brian Utterback
- December 19878
-
- */
-
- #include <stdio.h>
- #include <signal.h>
-
- main(argc,argv)
- int argc;
- char *argv[];
- {
- register char *cp;
- register int ch;
-
- /* 'of' filters are only passed width and length arguments from lpd */
- while (--argc) {
- if (*(cp = *++argv) == '-' ) {
- switch (cp[1]) {
- case 'w':
- /* this filter does nothing with width */
- break;
-
- case 'l':
- /* this filter does nothing with length */
- break;
-
- }
- }
- }
-
- printf("\033E");
- printf("\033&k3G");
- while ((ch=getchar()) != EOF) {
- switch(ch) {
-
- case '\31':
- /*
- * LPD needs to use a different filter to
- * print data so stop what we are doing
- * and wait for lpd to restart us.
- */
- if ((ch = getchar()) == '\01') {
- (void) fflush(stdout);
- (void) kill(getpid(), SIGSTOP);
- printf("\033E");
- printf("\033&k3G");
- break;
- } else {
- (void) ungetc(ch,stdin);
- ch='\31';
- }
- default:
- putchar(ch);
- break;
- }
- }
- exit(0);
- }
-