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: 16: extern unit units[]; /* logical units table from iolib */ 17: 18: ftnint fputc_(u, c, clen) 19: ftnint *u; char *c; ftnlen clen; 20: { 21: int i; 22: unit *lu; 23: 24: if (*u < 0 || *u >= MXUNIT) 25: return((ftnint)(errno=F_ERUNIT)); 26: lu = &units[*u]; 27: if (!lu->ufd) 28: return((ftnint)(errno=F_ERNOPEN)); 29: if (!lu->uwrt && ! nowwriting(lu)) 30: return((ftnint)errno); 31: putc (*c, lu->ufd); 32: if (ferror(lu->ufd)) 33: { 34: i = errno; 35: clearerr(lu->ufd); 36: return((ftnint)i); 37: } 38: return((ftnint) 0); 39: }