Annotation of 42BSD/usr.lib/libI77/due.c, revision 1.1

1.1     ! root        1: /*
        !             2: char id_due[] = "@(#)due.c     1.3";
        !             3:  *
        !             4:  * direct unformatted external i/o
        !             5:  */
        !             6: 
        !             7: #include "fio.h"
        !             8: 
        !             9: char rdue[] = "read due";
        !            10: char wdue[] = "write due";
        !            11: 
        !            12: s_rdue(a) cilist *a;
        !            13: {
        !            14:        int n;
        !            15:        reading = YES;
        !            16:        if(n=c_due(a,READ)) return(n);
        !            17:        if(curunit->uwrt && ! nowreading(curunit)) err(errflag, errno, rdue);
        !            18:        return(OK);
        !            19: }
        !            20: 
        !            21: s_wdue(a) cilist *a;
        !            22: {
        !            23:        int n;
        !            24:        reading = NO;
        !            25:        if(n=c_due(a,WRITE)) return(n);
        !            26:        curunit->uend = NO;
        !            27:        if(!curunit->uwrt && ! nowwriting(curunit)) err(errflag, errno, wdue)
        !            28:        return(OK);
        !            29: }
        !            30: 
        !            31: c_due(a,flag) cilist *a;
        !            32: {      int n;
        !            33:        lfname = NULL;
        !            34:        elist = NO;
        !            35:        sequential=formatted=NO;
        !            36:        recpos = reclen = 0;
        !            37:        external = YES;
        !            38:        errflag = a->cierr;
        !            39:        endflag = a->ciend;
        !            40:        lunit = a->ciunit;
        !            41:        if(not_legal(lunit)) err(errflag,F_ERUNIT,rdue+5);
        !            42:        curunit = &units[lunit];
        !            43:        if (!curunit->ufd && (n=fk_open(flag,DIR,UNF,(ftnint)lunit)) )
        !            44:                err(errflag,n,rdue+5)
        !            45:        cf = curunit->ufd;
        !            46:        elist = YES;
        !            47:        lfname = curunit->ufnm;
        !            48:        if (curunit->ufmt) err(errflag,F_ERNOUIO,rdue+5)
        !            49:        if (!curunit->useek || !curunit->url) err(errflag,F_ERNODIO,rdue+5)
        !            50:        if (fseek(cf, (long)((a->cirec-1)*curunit->url), 0) < 0)
        !            51:                return(due_err(rdue+5));
        !            52:        else
        !            53:                return(OK);
        !            54: }
        !            55: 
        !            56: e_rdue()
        !            57: {
        !            58:        return(OK);
        !            59: }
        !            60: 
        !            61: e_wdue()
        !            62: {/*    This is to ensure full records. It is really necessary. */
        !            63:        int n = 0;
        !            64:        if (curunit->url!=1 && recpos!=curunit->url &&
        !            65:            (fseek(cf, (long)(curunit->url-recpos-1), 1) < 0
        !            66:                || fwrite(&n, 1, 1, cf) != 1))
        !            67:                        return(due_err(rdue+5));
        !            68:        return(OK);
        !            69: }

unix.superglobalmegacorp.com

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