Annotation of researchv10no/libI77/notused/setvbuf.c, revision 1.1

1.1     ! root        1: /*     @(#)setvbuf.c   1.2                     */
        !             2: /*LINTLIBRARY*/
        !             3: #include "stdio.h"
        !             4: 
        !             5: extern void free();
        !             6: extern int isatty();
        !             7: 
        !             8: int
        !             9: setvbuf(iop, type, buf, size)
        !            10: register FILE *iop;
        !            11: register int type;
        !            12: register char  *buf;
        !            13: register int size;
        !            14: {
        !            15:        char *malloc();
        !            16: 
        !            17:        if(iop->_base != NULL && iop->_flag & _IOMYBUF)
        !            18:                free((char*)iop->_base);
        !            19:        iop->_flag &= ~(_IOMYBUF | _IONBF | _IOLBF);
        !            20:        switch (type)  {
        !            21:            /*note that the flags are the same as the possible values for type*/
        !            22:            case _IONBF:
        !            23:                /* file is unbuffered */
        !            24:                iop->_flag |= _IONBF;
        !            25:                _bufend(iop) = iop->_base = NULL;
        !            26:                break;
        !            27:            case _IOLBF:
        !            28:            case _IOFBF:
        !            29:                iop->_flag |= type;
        !            30:                size = (size == 0) ? BUFSIZ : size;
        !            31:                if ((size > BUFSIZ) || (iop->_base == NULL))
        !            32:                        iop->_base = (unsigned char *)
        !            33:                                     malloc((unsigned)(size + 8));
        !            34:                _bufend(iop) = iop->_base + size;
        !            35:                break;
        !            36:            default:
        !            37:                return -1;
        !            38:        }
        !            39:        iop->_ptr = iop->_base;
        !            40:        iop->_cnt = 0;
        !            41:        return 0;
        !            42: }

unix.superglobalmegacorp.com

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