12409Sdlw /* 2*3893Sdlw char id_fputc[] = @(#)fputc_.c 1.3"; 32409Sdlw * 42409Sdlw * write a character to a logical unit bypassing formatted I/O 52409Sdlw * 62409Sdlw * calling sequence: 72409Sdlw * integer fputc 82409Sdlw * ierror = fputc (unit, char) 92409Sdlw * where: 102409Sdlw * char will be sent to the logical unit 112409Sdlw * ierror will be 0 if successful; a system error code otherwise. 122409Sdlw */ 132409Sdlw 142409Sdlw #include "../libI77/fiodefs.h" 152409Sdlw #include "../libI77/f_errno.h" 162409Sdlw 172409Sdlw extern unit units[]; /* logical units table from iolib */ 182409Sdlw 192409Sdlw long fputc_(u, c, clen) 202409Sdlw long *u; char *c; long clen; 212409Sdlw { 22*3893Sdlw int i; 23*3893Sdlw unit *lu; 242409Sdlw 252409Sdlw if (*u < 0 || *u >= MXUNIT) 262577Sdlw return((long)(errno=F_ERUNIT)); 27*3893Sdlw lu = &units[*u]; 28*3893Sdlw if (!lu->ufd) 292409Sdlw return((long)(errno=F_ERNOPEN)); 30*3893Sdlw if (!lu->uwrt) 31*3893Sdlw nowwriting(lu); 32*3893Sdlw putc (*c, lu->ufd); 33*3893Sdlw if (ferror(lu->ufd)) 342409Sdlw { 352409Sdlw i = errno; 36*3893Sdlw clearerr(lu->ufd); 372409Sdlw return((long)i); 382409Sdlw } 392409Sdlw return(0L); 402409Sdlw } 41