12408Sdlw /* 2*4111Sdlw char id_putc[] = "@(#)putc_.c 1.3"; 32408Sdlw * 42408Sdlw * write a character to the standard output 52408Sdlw * 62408Sdlw * calling sequence: 72408Sdlw * integer putc 82408Sdlw * ierror = putc (char) 92408Sdlw * where: 102408Sdlw * char will be sent to the standard output, usually the terminal 112408Sdlw * ierror will be 0 if successful; a system error code otherwise. 122408Sdlw */ 132408Sdlw 142408Sdlw #include "../libI77/f_errno.h" 152408Sdlw #include "../libI77/fiodefs.h" 162408Sdlw 172408Sdlw extern unit units[]; /* logical units table from iolib */ 182408Sdlw 192408Sdlw long putc_(c, clen) 202408Sdlw char *c; long clen; 212408Sdlw { 223894Sdlw int i; 233894Sdlw unit *lu; 242408Sdlw 253894Sdlw lu = &units[STDOUT]; 263894Sdlw if (!lu->ufd) 272408Sdlw return((long)(errno=F_ERNOPEN)); 28*4111Sdlw if (!lu->uwrt && ! nowwriting(lu)) 29*4111Sdlw return((long)errno); 303894Sdlw putc (*c, lu->ufd); 313894Sdlw if (ferror(lu->ufd)) 322408Sdlw { 332408Sdlw i = errno; 343894Sdlw clearerr(lu->ufd); 352408Sdlw return((long)i); 362408Sdlw } 372408Sdlw return(0L); 382408Sdlw } 39