Annotation of researchv10no/cmd/spitbol/cint/osclose.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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