1: /*
   2: char id_sfe[] = "@(#)sfe.c	1.6";
   3:  *
   4:  * sequential formatted external routines
   5:  */
   6: 
   7: #include "fio.h"
   8: 
   9: /*
  10:  * read sequential formatted external
  11:  */
  12: 
  13: extern int rd_ed(),rd_ned();
  14: int x_tab();
  15: 
  16: extern char rsfe[];
  17: extern char wsfe[];
  18: 
  19: e_rsfe()
  20: {   int n;
  21:     n=en_fio();
  22:     fmtbuf=NULL;
  23:     return(n);
  24: }
  25: 
  26: c_sfe(a,flag) cilist *a; /* check */
  27: {   unit *p;
  28:     int n;
  29:     external=sequential=formatted=FORMATTED;
  30:     fmtbuf=a->cifmt;
  31:     lfname = NULL;
  32:     elist = NO;
  33:     errflag = a->cierr;
  34:     endflag = a->ciend;
  35:     lunit = a->ciunit;
  36:     if(not_legal(lunit)) err(errflag,F_ERUNIT,rsfe+5);
  37:     curunit = p = &units[lunit];
  38:     if(!p->ufd && (n=fk_open(flag,SEQ,FMT,(ftnint)lunit)) )
  39:         err(errflag,n,rsfe+5)
  40:     cf = curunit->ufd;
  41:     elist = YES;
  42:     lfname = curunit->ufnm;
  43:     if(!p->ufmt) err(errflag,F_ERNOFIO,rsfe+5)
  44:     if(p->url) err(errflag,F_ERNOSIO,rsfe+5)
  45:     cursor=recpos=scale=reclen=0;
  46:     radix = 10;
  47:     signit = YES;
  48:     cblank = curunit->ublnk;
  49:     cplus = NO;
  50:     return(OK);
  51: }
  52: 
  53: /*
  54:  * write sequential formatted external
  55:  */
  56: 
  57: extern int w_ed(),w_ned();
  58: 
  59: x_tab()
  60: {   int n;
  61:     if(reclen < recpos) reclen = recpos;
  62:     if(curunit->useek)
  63:     {   if((recpos+cursor) < 0) cursor = -recpos;   /* to BOR */
  64:         n = reclen - recpos;    /* distance to eor, n>=0 */
  65:         if((cursor-n) > 0)
  66:         {   fseek(cf,(long)n,1);  /* find current eor */
  67:             recpos = reclen;
  68:             cursor -= n;
  69:         }
  70:         else
  71:         {   fseek(cf,(long)cursor,1);  /* do not pass go */
  72:             recpos += cursor;
  73:             return(cursor=0);
  74:         }
  75:     }
  76:     else
  77:         if(cursor < 0) return(F_ERSEEK);   /* can't go back */
  78:     while(cursor--)
  79:     {   if(reading)
  80:         {   n = (*getn)();
  81:             if(n=='\n')
  82:             {   (*ungetn)(n,cf);
  83:                 return(F_EREREC);
  84:             }
  85:             if(n==EOF) return(EOF);
  86:         }
  87:         else    (*putn)(' ');   /* fill in the empty record */
  88:     }
  89:     return(cursor=0);
  90: }
  91: 
  92: /*
  93: /*xw_rev()
  94: /*{
  95: /*	if(workdone) x_wSL();
  96: /*	return(workdone=0);
  97: /*}
  98: /*
  99: */
 100: e_wsfe()
 101: {   return(e_rsfe()); }

Defined functions

c_sfe defined in line 26; used 2 times
e_rsfe defined in line 19; used 1 times
e_wsfe defined in line 100; never used
x_tab defined in line 59; used 5 times
Last modified: 1983-06-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 775
Valid CSS Valid XHTML 1.0 Strict