Annotation of researchv10no/cmd/spitbol/osclose.c, revision 1.1

1.1     ! root        1: 
        !             2: /*
        !             3:        osclose( ioptr ) closes the file represented by the ioblk.
        !             4:        osclose will flush an output file's buffer before closing.
        !             5: */
        !             6: 
        !             7: #include "spitblks.h"
        !             8: #include "spitio.h"
        !             9: 
        !            10: int
        !            11: osclose( ioptr )
        !            12: 
        !            13: struct ioblk   *ioptr;
        !            14: 
        !            15: {
        !            16:        register int    errcnt = 0;
        !            17: 
        !            18:        if ( !(ioptr -> flg & IO_OPN))
        !            19:                return 0;
        !            20: 
        !            21:        if ( ioptr -> flg & IO_OUP )
        !            22:                errcnt += flush( ioptr );
        !            23: 
        !            24:        if ( ioptr -> flg & IO_SYS )
        !            25:                return errcnt;
        !            26: 
        !            27:        if ( close( ioptr -> fdn ) < 0)
        !            28:                errcnt++;
        !            29:        ioptr -> flg &= ~IO_OPN;
        !            30: 
        !            31:        if ( ioptr -> flg & IO_PIP ) {
        !            32:                if ( ioptr -> flg & IO_DED )
        !            33:                        ioptr -> flg &= ~IO_DED;
        !            34:                else if ( ioptr -> flg & IO_INP ) {
        !            35:                        kill( ioptr -> pid );
        !            36:                        oswait( ioptr -> pid);
        !            37:                } else oswait( ioptr -> pid );
        !            38:        }
        !            39: 
        !            40:        return errcnt;
        !            41: }
        !            42: 

unix.superglobalmegacorp.com

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