|
|
1.1 root 1: /*
2: * Copyright (c) 1980 Regents of the University of California.
3: * All rights reserved. The Berkeley software License Agreement
4: * specifies the terms and conditions for redistribution.
5: *
6: * @(#)fputc_.c 5.1 6/7/85
7: */
8:
9: /*
10: * write a character to a logical unit bypassing formatted I/O
11: *
12: * calling sequence:
13: * integer fputc
14: * ierror = fputc (unit, char)
15: * where:
16: * char will be sent to the logical unit
17: * ierror will be 0 if successful; a system error code otherwise.
18: */
19:
20: #include "../libI77/fiodefs.h"
21: #include "../libI77/f_errno.h"
22:
23: extern unit units[]; /* logical units table from iolib */
24:
25: long fputc_(u, c, clen)
26: long *u; char *c; long clen;
27: {
28: int i;
29: unit *lu;
30:
31: if (*u < 0 || *u >= MXUNIT)
32: return((long)(errno=F_ERUNIT));
33: lu = &units[*u];
34: if (!lu->ufd)
35: return((long)(errno=F_ERNOPEN));
36: if (!lu->uwrt && ! nowwriting(lu))
37: return((long)errno);
38: putc (*c, lu->ufd);
39: if (ferror(lu->ufd))
40: {
41: i = errno;
42: clearerr(lu->ufd);
43: return((long)i);
44: }
45: return(0L);
46: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.