Annotation of 43BSDTahoe/lib/libc/stdio/fputs.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1984 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: 
        !             7: #if defined(LIBC_SCCS) && !defined(lint)
        !             8: static char sccsid[] = "@(#)fputs.c    5.2 (Berkeley) 3/9/86";
        !             9: #endif LIBC_SCCS and not lint
        !            10: 
        !            11: #include       <stdio.h>
        !            12: 
        !            13: fputs(s, iop)
        !            14: register char *s;
        !            15: register FILE *iop;
        !            16: {
        !            17:        register r = 0;
        !            18:        register c;
        !            19:        int unbuffered;
        !            20:        char localbuf[BUFSIZ];
        !            21: 
        !            22:        unbuffered = iop->_flag & _IONBF;
        !            23:        if (unbuffered) {
        !            24:                iop->_flag &= ~_IONBF;
        !            25:                iop->_ptr = iop->_base = localbuf;
        !            26:                iop->_bufsiz = BUFSIZ;
        !            27:        }
        !            28: 
        !            29:        while (c = *s++)
        !            30:                r = putc(c, iop);
        !            31: 
        !            32:        if (unbuffered) {
        !            33:                fflush(iop);
        !            34:                iop->_flag |= _IONBF;
        !            35:                iop->_base = NULL;
        !            36:                iop->_bufsiz = NULL;
        !            37:                iop->_cnt = 0;
        !            38:        }
        !            39: 
        !            40:        return(r);
        !            41: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.