1 /* 2 char id_fputc[] = @(#)fputc_.c 1.2"; 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 24 if (*u < 0 || *u >= MXUNIT) 25 return((long)(errno=F_ERUNIT)); 26 if (!units[*u].ufd) 27 return((long)(errno=F_ERNOPEN)); 28 putc (*c, units[*u].ufd); 29 if (ferror(units[*u].ufd)) 30 { 31 i = errno; 32 clearerr(units[*u].ufd); 33 return((long)i); 34 } 35 return(0L); 36 } 37