Commit | Line | Data |
---|---|---|
494a7a96 | 1 | /* |
70d9135d | 2 | char id_putc[] = "@(#)putc_.c 1.2"; |
494a7a96 DW |
3 | * |
4 | * write a character to the standard output | |
5 | * | |
6 | * calling sequence: | |
7 | * integer putc | |
8 | * ierror = putc (char) | |
9 | * where: | |
10 | * char will be sent to the standard output, usually the terminal | |
11 | * ierror will be 0 if successful; a system error code otherwise. | |
12 | */ | |
13 | ||
14 | #include "../libI77/f_errno.h" | |
15 | #include "../libI77/fiodefs.h" | |
16 | ||
17 | extern unit units[]; /* logical units table from iolib */ | |
18 | ||
19 | long putc_(c, clen) | |
20 | char *c; long clen; | |
21 | { | |
70d9135d DW |
22 | int i; |
23 | unit *lu; | |
494a7a96 | 24 | |
70d9135d DW |
25 | lu = &units[STDOUT]; |
26 | if (!lu->ufd) | |
494a7a96 | 27 | return((long)(errno=F_ERNOPEN)); |
70d9135d DW |
28 | if (!lu->uwrt) |
29 | nowwriting(lu); | |
30 | putc (*c, lu->ufd); | |
31 | if (ferror(lu->ufd)) | |
494a7a96 DW |
32 | { |
33 | i = errno; | |
70d9135d | 34 | clearerr(lu->ufd); |
494a7a96 DW |
35 | return((long)i); |
36 | } | |
37 | return(0L); | |
38 | } |