1 /*- 2 * Copyright (c) 1980 The Regents of the University of California. 3 * All rights reserved. 4 * 5 * %sccs.include.proprietary.c% 6 */ 7 8 #ifndef lint 9 static char sccsid[] = "@(#)putc_.c 5.2 (Berkeley) 04/12/91"; 10 #endif /* not lint */ 11 12 /* 13 * write a character to the standard output 14 * 15 * calling sequence: 16 * integer putc 17 * ierror = putc (char) 18 * where: 19 * char will be sent to the standard output, usually the terminal 20 * ierror will be 0 if successful; a system error code otherwise. 21 */ 22 23 #include "../libI77/f_errno.h" 24 #include "../libI77/fiodefs.h" 25 26 extern unit units[]; /* logical units table from iolib */ 27 28 long putc_(c, clen) 29 char *c; long clen; 30 { 31 int i; 32 unit *lu; 33 34 lu = &units[STDOUT]; 35 if (!lu->ufd) 36 return((long)(errno=F_ERNOPEN)); 37 if (!lu->uwrt && ! nowwriting(lu)) 38 return((long)errno); 39 putc (*c, lu->ufd); 40 if (ferror(lu->ufd)) 41 { 42 i = errno; 43 clearerr(lu->ufd); 44 return((long)i); 45 } 46 return(0L); 47 } 48