1: /*
   2: char id_douio[] = "@(#)douio.c	1.2";
   3:  *
   4:  * unformatted external i/o
   5:  */
   6: 
   7: #include "fio.h"
   8: 
   9: char *eor = "eor/uio";
  10: char *uio = "uio";
  11: 
  12: do_us(number,ptr,len) ftnint *number; ftnlen len; char *ptr;  /* sequential */
  13: {
  14:     if(reading)
  15:     {
  16:         recpos += *number * len;
  17:         if (recpos > reclen)
  18:             err(errflag,F_EREREC,eor);
  19: 
  20:         if (fread(ptr,(int)len,(int)(*number),cf) != *number)
  21:             return(due_err(uio));
  22:     }
  23:     else
  24:     {
  25:         reclen += *number * len;
  26:         fwrite(ptr,(int)len,(int)(*number),cf);
  27:     }
  28:     return(OK);
  29: }
  30: 
  31: do_uio(number,ptr,len) ftnint *number; ftnlen len; char *ptr;
  32: {
  33:     if(sequential)
  34:         return(do_us(number,ptr,len));
  35:     else
  36:         return(do_ud(number,ptr,len));
  37: }
  38: 
  39: do_ud(number,ptr,len) ftnint *number; ftnlen len; char *ptr;  /* direct */
  40: {
  41:     recpos += *number * len;
  42:     if(recpos > curunit->url && curunit->url!=1)
  43:         err(errflag,F_EREREC,eor);
  44:     if(reading)
  45:     {
  46:         if (fread(ptr, (int)len, (int)(*number), cf) != *number)
  47:             return(due_err(uio));
  48:     }
  49:     else
  50:         fwrite(ptr,(int)len,(int)(*number),cf);
  51:     return(OK);
  52: }
  53: 
  54: due_err(s) char *s;
  55: {
  56:     if(feof(cf))
  57:         err(endflag,EOF,s)
  58:     else
  59:     {   clearerr(cf);
  60:         err(errflag,errno,s)
  61:     }
  62: }

Defined functions

do_ud defined in line 39; used 1 times
  • in line 36
do_uio defined in line 31; never used
do_us defined in line 12; used 1 times
  • in line 34
due_err defined in line 54; used 4 times

Defined variables

eor defined in line 9; used 2 times
uio defined in line 10; used 2 times
Last modified: 1983-05-20
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 875
Valid CSS Valid XHTML 1.0 Strict