1 /* 2 char id_fputc[] = @(#)fputc_.c 1.4"; 3 * 4 * write a character to a logical unit bypassing formatted I/O 5 * 6 * calling sequence: 7 * integer fputc 8 * ierror = fputc (unit, char) 9 * where: 10 * char will be sent to the logical unit 11 * ierror will be 0 if successful; a system error code otherwise. 12 */ 13 14 #include "../libI77/fiodefs.h" 15 #include "../libI77/f_errno.h" 16 17 extern unit units[]; /* logical units table from iolib */ 18 19 long fputc_(u, c, clen) 20 long *u; char *c; long clen; 21 { 22 int i; 23 unit *lu; 24 25 if (*u < 0 || *u >= MXUNIT) 26 return((long)(errno=F_ERUNIT)); 27 lu = &units[*u]; 28 if (!lu->ufd) 29 return((long)(errno=F_ERNOPEN)); 30 if (!lu->uwrt && ! nowwriting(lu)) 31 return((long)errno); 32 putc (*c, lu->ufd); 33 if (ferror(lu->ufd)) 34 { 35 i = errno; 36 clearerr(lu->ufd); 37 return((long)i); 38 } 39 return(0L); 40 } 41