xref: /csrg-svn/old/vfilters/necf/necf.c (revision 34590)
1 /*
2  * Copyright (c) 1983 Regents of the University of California.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms are permitted
6  * provided that this notice is preserved and that due credit is given
7  * to the University of California at Berkeley. The name of the University
8  * may not be used to endorse or promote products derived from this
9  * software without specific prior written permission. This software
10  * is provided ``as is'' without express or implied warranty.
11  */
12 
13 #ifndef lint
14 char copyright[] =
15 "@(#) Copyright (c) 1983 Regents of the University of California.\n\
16  All rights reserved.\n";
17 #endif /* not lint */
18 
19 #ifndef lint
20 static char sccsid[] = "@(#)necf.c	5.3 (Berkeley) 06/01/88";
21 #endif /* not lint */
22 
23 #include <stdio.h>
24 #include <sgtty.h>
25 
26 #define PAGESIZE	66
27 
28 main()
29 {
30 	extern char *rindex();
31 	char line[256];
32 	register char c, *cp;
33 	register lnumber;
34 
35 #ifdef SHEETFEEDER
36 	printf("\033=\033\033\033O\f");
37 #else
38 	printf("\033=");
39 #endif
40 	lnumber = 0;
41 	while (fgets(line, sizeof(line), stdin) != NULL) {
42 #ifdef SHEETFEEDER
43 		if (lnumber == PAGESIZE-1) {
44 			putchar('\f');
45 			lnumber = 0;
46 		}
47 		if (lnumber >= 2) {
48 #endif
49 #ifdef TTY
50 			if ((cp = rindex(line, '\n')) != NULL)
51 				*cp = '\r';
52 #endif
53 			printf("%s", line);
54 #ifdef SHEETFEEDER
55 		}
56 		lnumber++;
57 #endif
58 	}
59 	fflush (stdout);
60 }
61