xref: /original-bsd/old/vfilters/necf/necf.c (revision 237fdba6)
1 /*
2  * Copyright (c) 1983 Regents of the University of California.
3  * All rights reserved.
4  *
5  * %sccs.include.redist.c%
6  */
7 
8 #ifndef lint
9 char copyright[] =
10 "@(#) Copyright (c) 1983 Regents of the University of California.\n\
11  All rights reserved.\n";
12 #endif /* not lint */
13 
14 #ifndef lint
15 static char sccsid[] = "@(#)necf.c	5.5 (Berkeley) 06/01/90";
16 #endif /* not lint */
17 
18 #include <stdio.h>
19 #include <sgtty.h>
20 
21 #define PAGESIZE	66
22 
23 main()
24 {
25 	extern char *rindex();
26 	char line[256];
27 	register char c, *cp;
28 	register lnumber;
29 
30 #ifdef SHEETFEEDER
31 	printf("\033=\033\033\033O\f");
32 #else
33 	printf("\033=");
34 #endif
35 	lnumber = 0;
36 	while (fgets(line, sizeof(line), stdin) != NULL) {
37 #ifdef SHEETFEEDER
38 		if (lnumber == PAGESIZE-1) {
39 			putchar('\f');
40 			lnumber = 0;
41 		}
42 		if (lnumber >= 2) {
43 #endif
44 #ifdef TTY
45 			if ((cp = rindex(line, '\n')) != NULL)
46 				*cp = '\r';
47 #endif
48 			printf("%s", line);
49 #ifdef SHEETFEEDER
50 		}
51 		lnumber++;
52 #endif
53 	}
54 	fflush (stdout);
55 }
56