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

Defined functions

c_due defined in line 37; used 2 times
e_rdue defined in line 63; never used
e_wdue defined in line 68; never used
s_rdue defined in line 18; never used
s_wdue defined in line 27; never used

Defined variables

rdue defined in line 15; used 7 times
wdue defined in line 16; used 1 times
  • in line 33
Last modified: 1985-06-08
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1060
Valid CSS Valid XHTML 1.0 Strict