1*47944Sbostic /*- 2*47944Sbostic * Copyright (c) 1980 The Regents of the University of California. 3*47944Sbostic * All rights reserved. 42408Sdlw * 5*47944Sbostic * %sccs.include.proprietary.c% 623043Skre */ 723043Skre 8*47944Sbostic #ifndef lint 9*47944Sbostic static char sccsid[] = "@(#)putc_.c 5.2 (Berkeley) 04/12/91"; 10*47944Sbostic #endif /* not lint */ 11*47944Sbostic 1223043Skre /* 132408Sdlw * write a character to the standard output 142408Sdlw * 152408Sdlw * calling sequence: 162408Sdlw * integer putc 172408Sdlw * ierror = putc (char) 182408Sdlw * where: 192408Sdlw * char will be sent to the standard output, usually the terminal 202408Sdlw * ierror will be 0 if successful; a system error code otherwise. 212408Sdlw */ 222408Sdlw 232408Sdlw #include "../libI77/f_errno.h" 242408Sdlw #include "../libI77/fiodefs.h" 252408Sdlw 262408Sdlw extern unit units[]; /* logical units table from iolib */ 272408Sdlw putc_(c,clen)282408Sdlwlong putc_(c, clen) 292408Sdlw char *c; long clen; 302408Sdlw { 313894Sdlw int i; 323894Sdlw unit *lu; 332408Sdlw 343894Sdlw lu = &units[STDOUT]; 353894Sdlw if (!lu->ufd) 362408Sdlw return((long)(errno=F_ERNOPEN)); 374111Sdlw if (!lu->uwrt && ! nowwriting(lu)) 384111Sdlw return((long)errno); 393894Sdlw putc (*c, lu->ufd); 403894Sdlw if (ferror(lu->ufd)) 412408Sdlw { 422408Sdlw i = errno; 433894Sdlw clearerr(lu->ufd); 442408Sdlw return((long)i); 452408Sdlw } 462408Sdlw return(0L); 472408Sdlw } 48