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.2 (Berkeley) 03/08/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 _sobuf[BUFSIZ]; 31 extern char *rindex(); 32 char line[256]; 33 register char c, *cp; 34 register lnumber; 35 36 setbuf(stdout, _sobuf); 37 #ifdef SHEETFEEDER 38 printf("\033=\033\033\033O\f"); 39 #else 40 printf("\033="); 41 #endif 42 lnumber = 0; 43 while (fgets(line, sizeof(line), stdin) != NULL) { 44 #ifdef SHEETFEEDER 45 if (lnumber == PAGESIZE-1) { 46 putchar('\f'); 47 lnumber = 0; 48 } 49 if (lnumber >= 2) { 50 #endif 51 #ifdef TTY 52 if ((cp = rindex(line, '\n')) != NULL) 53 *cp = '\r'; 54 #endif 55 printf("%s", line); 56 #ifdef SHEETFEEDER 57 } 58 lnumber++; 59 #endif 60 } 61 fflush (stdout); 62 } 63