1*2411Sdlw /* 2*2411Sdlw char id_getc[] = "@(#)getc_.c 1.1"; 3*2411Sdlw * 4*2411Sdlw * get a character from the standard input 5*2411Sdlw * 6*2411Sdlw * calling sequence: 7*2411Sdlw * integer getc 8*2411Sdlw * ierror = getc (char) 9*2411Sdlw * where: 10*2411Sdlw * char will be read from the standard input, usually the terminal 11*2411Sdlw * ierror will be 0 if successful; a system error code otherwise. 12*2411Sdlw */ 13*2411Sdlw 14*2411Sdlw #include "../libI77/f_errno.h" 15*2411Sdlw #include "../libI77/fiodefs.h" 16*2411Sdlw 17*2411Sdlw extern unit units[]; /* logical units table from iolib */ 18*2411Sdlw 19*2411Sdlw long getc_(c, clen) 20*2411Sdlw char *c; long clen; 21*2411Sdlw { 22*2411Sdlw int i; 23*2411Sdlw 24*2411Sdlw if (!units[STDIN].ufd) 25*2411Sdlw return((long)(errno=F_ERNOPEN)); 26*2411Sdlw if ((i = getc (units[STDIN].ufd)) < 0) 27*2411Sdlw { 28*2411Sdlw if (feof(units[STDIN].ufd)) 29*2411Sdlw return(-1L); 30*2411Sdlw i = errno; 31*2411Sdlw clearerr(units[STDIN].ufd); 32*2411Sdlw return((long)i); 33*2411Sdlw } 34*2411Sdlw *c = i & 0177; 35*2411Sdlw return(0L); 36*2411Sdlw } 37