12408Sdlw /* 2*23043Skre * Copyright (c) 1980 Regents of the University of California. 3*23043Skre * All rights reserved. The Berkeley software License Agreement 4*23043Skre * specifies the terms and conditions for redistribution. 52408Sdlw * 6*23043Skre * @(#)putc_.c 5.1 06/07/85 7*23043Skre */ 8*23043Skre 9*23043Skre /* 102408Sdlw * write a character to the standard output 112408Sdlw * 122408Sdlw * calling sequence: 132408Sdlw * integer putc 142408Sdlw * ierror = putc (char) 152408Sdlw * where: 162408Sdlw * char will be sent to the standard output, usually the terminal 172408Sdlw * ierror will be 0 if successful; a system error code otherwise. 182408Sdlw */ 192408Sdlw 202408Sdlw #include "../libI77/f_errno.h" 212408Sdlw #include "../libI77/fiodefs.h" 222408Sdlw 232408Sdlw extern unit units[]; /* logical units table from iolib */ 242408Sdlw 252408Sdlw long putc_(c, clen) 262408Sdlw char *c; long clen; 272408Sdlw { 283894Sdlw int i; 293894Sdlw unit *lu; 302408Sdlw 313894Sdlw lu = &units[STDOUT]; 323894Sdlw if (!lu->ufd) 332408Sdlw return((long)(errno=F_ERNOPEN)); 344111Sdlw if (!lu->uwrt && ! nowwriting(lu)) 354111Sdlw return((long)errno); 363894Sdlw putc (*c, lu->ufd); 373894Sdlw if (ferror(lu->ufd)) 382408Sdlw { 392408Sdlw i = errno; 403894Sdlw clearerr(lu->ufd); 412408Sdlw return((long)i); 422408Sdlw } 432408Sdlw return(0L); 442408Sdlw } 45