Annotation of researchv10dc/libI77/old/close.c, revision 1.1.1.1

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

unix.superglobalmegacorp.com

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