Annotation of 3BSD/libI77/close.c, revision 1.1.1.1

1.1       root        1: #include "fio.h"
                      2: f_clos(a) cllist *a;
                      3: {      unit *b;
                      4:        if(a->cunit >= MXUNIT) return(0);
                      5:        b= &units[a->cunit];
                      6:        if(b->ufd==NULL) return(0);
                      7:        b->uend=0;
                      8:        if(a->csta!=0)
                      9:                switch(*a->csta)
                     10:                {
                     11:                default:
                     12:                keep:
                     13:                case 'k':
                     14:                        if(b->uwrt) t_runc(b);
                     15:                        if(fclose(b->ufd) != 0) abort();
                     16:                        if(b->ufnm!=0) free(b->ufnm);
                     17:                        b->ufnm=NULL;
                     18:                        b->ufd=NULL;
                     19:                        return(0);
                     20:                case 'd':
                     21:                delete:
                     22:                        fclose(b->ufd);
                     23:                        if(b->ufnm!=0)
                     24:                        {       unlink(b->ufnm); /*SYSDEP*/
                     25:                                free(b->ufnm);
                     26:                        }
                     27:                        b->ufnm=NULL;
                     28:                        b->ufd=NULL;
                     29:                        return(0);
                     30:                }
                     31:        else if(b->uscrtch==1) goto delete;
                     32:        else goto keep;
                     33: }
                     34: f_exit()
                     35: {      int i;
                     36:        cllist xx;
                     37:        xx.cerr=1;
                     38:        xx.csta=NULL;
                     39:        for(i=0;i<MXUNIT;i++)
                     40:        {
                     41:                xx.cunit=i;
                     42:                f_clos(&xx);
                     43:        }
                     44: }
                     45: flush_()
                     46: {      int i;
                     47:        for(i=0;i<MXUNIT;i++)
                     48:                if(units[i].ufd != NULL) fflush(units[i].ufd);
                     49: }

unix.superglobalmegacorp.com

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