xref: /csrg-svn/old/vfilters/necf/necf.c (revision 42804)
120200Sdist /*
220200Sdist  * Copyright (c) 1983 Regents of the University of California.
333682Sbostic  * All rights reserved.
433682Sbostic  *
5*42804Sbostic  * %sccs.include.redist.c%
620200Sdist  */
720200Sdist 
813945Ssam #ifndef lint
933682Sbostic char copyright[] =
1033682Sbostic "@(#) Copyright (c) 1983 Regents of the University of California.\n\
1133682Sbostic  All rights reserved.\n";
1233682Sbostic #endif /* not lint */
1313945Ssam 
1433682Sbostic #ifndef lint
15*42804Sbostic static char sccsid[] = "@(#)necf.c	5.5 (Berkeley) 06/01/90";
1633682Sbostic #endif /* not lint */
1733682Sbostic 
183676Sroot #include <stdio.h>
193676Sroot #include <sgtty.h>
203676Sroot 
213818Ssam #define PAGESIZE	66
223818Ssam 
main()233676Sroot main()
243676Sroot {
253818Ssam 	extern char *rindex();
263818Ssam 	char line[256];
273818Ssam 	register char c, *cp;
283818Ssam 	register lnumber;
293676Sroot 
303840Ssam #ifdef SHEETFEEDER
313818Ssam 	printf("\033=\033\033\033O\f");
323840Ssam #else
333840Ssam 	printf("\033=");
343840Ssam #endif
353818Ssam 	lnumber = 0;
363818Ssam 	while (fgets(line, sizeof(line), stdin) != NULL) {
373840Ssam #ifdef SHEETFEEDER
383818Ssam 		if (lnumber == PAGESIZE-1) {
393818Ssam 			putchar('\f');
403818Ssam 			lnumber = 0;
413818Ssam 		}
423818Ssam 		if (lnumber >= 2) {
433840Ssam #endif
444218Ssam #ifdef TTY
453818Ssam 			if ((cp = rindex(line, '\n')) != NULL)
463818Ssam 				*cp = '\r';
474218Ssam #endif
483818Ssam 			printf("%s", line);
493840Ssam #ifdef SHEETFEEDER
503818Ssam 		}
513818Ssam 		lnumber++;
523840Ssam #endif
533818Ssam 	}
543676Sroot 	fflush (stdout);
553676Sroot }
56