xref: /csrg-svn/usr.bin/f77/libU77/putc_.c (revision 2408)
1*2408Sdlw /*
2*2408Sdlw char id_putc[] = "@(#)putc_.c	1.1";
3*2408Sdlw  *
4*2408Sdlw  * write a character to the standard output
5*2408Sdlw  *
6*2408Sdlw  * calling sequence:
7*2408Sdlw  *	integer putc
8*2408Sdlw  *	ierror =  putc (char)
9*2408Sdlw  * where:
10*2408Sdlw  *	char will be sent to the standard output, usually the terminal
11*2408Sdlw  *	ierror will be 0 if successful; a system error code otherwise.
12*2408Sdlw  */
13*2408Sdlw 
14*2408Sdlw #include	"../libI77/f_errno.h"
15*2408Sdlw #include	"../libI77/fiodefs.h"
16*2408Sdlw 
17*2408Sdlw extern unit units[];	/* logical units table from iolib */
18*2408Sdlw 
19*2408Sdlw long putc_(c, clen)
20*2408Sdlw char *c; long clen;
21*2408Sdlw {
22*2408Sdlw 	int i;
23*2408Sdlw 
24*2408Sdlw 	if (!units[STDOUT].ufd)
25*2408Sdlw 		return((long)(errno=F_ERNOPEN));
26*2408Sdlw 	putc (*c, units[STDOUT].ufd);
27*2408Sdlw 	if (ferror(units[STDOUT].ufd))
28*2408Sdlw 	{
29*2408Sdlw 		i = errno;
30*2408Sdlw 		clearerr(units[STDOUT].ufd);
31*2408Sdlw 		return((long)i);
32*2408Sdlw 	}
33*2408Sdlw 	return(0L);
34*2408Sdlw }
35