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:  *	@(#)c_dfe.c	5.2	7/30/85
   7:  */
   8: 
   9: /*
  10:  * direct formatted external i/o - common read/write routines
  11:  */
  12: 
  13: #include "fio.h"
  14: 
  15: c_dfe(a,flag,str) cilist *a; char *str;
  16: {   int n;
  17:     sequential = NO;
  18:     external = YES;
  19:     formatted = FORMATTED;
  20:     lfname = NULL;
  21:     elist = NO;
  22:     cursor=scale=recpos=reclen=0;
  23:     radix = 10;
  24:     signit = YES;
  25:     fmtbuf = a->cifmt;
  26:     errflag = a->cierr;
  27:     endflag = a->ciend;
  28:     lunit = a->ciunit;
  29:     if(not_legal(lunit)) err(errflag,F_ERUNIT,str);
  30:     curunit = &units[lunit];
  31:     if(!curunit->ufd && (n=fk_open(flag,DIR,FMT,(ftnint)lunit)))
  32:         err(errflag,n,str)
  33:     cf = curunit->ufd;
  34:     elist = YES;
  35:     lfname = curunit->ufnm;
  36:     if(!curunit->ufmt) err(errflag,F_ERNOFIO,str)
  37:     if(!curunit->useek || !curunit->url) err(errflag,F_ERNODIO,str)
  38:     recnum = a->cirec - 1;
  39:     fseek(cf, (long)curunit->url * recnum, 0);
  40:     cblank = curunit->ublnk;
  41:     cplus = NO;
  42:     return(OK);
  43: }
  44: 
  45: y_tab()
  46: {   int n;
  47:     if(curunit->url==1)
  48:     {
  49:         if(cursor < 0 && -cursor > ftell(cf)) rewind(cf);
  50:         else    fseek(cf,(long)cursor,1);
  51:         return(cursor=0);
  52:     }
  53:     else
  54:     {   if(reclen < recpos) reclen = recpos;
  55:         if((recpos + cursor) < 0) cursor = -recpos; /* BOR */
  56:         n = reclen - recpos;        /* n >= 0 */
  57:         if(!reading && (cursor-n) > 0)
  58:         {   recpos = reclen;
  59:             cursor -= n;
  60:             fseek(cf,(long)n,1);
  61:             while(cursor--) if(n=(*putn)(' ')) return(n);
  62:             return(cursor=0);
  63:         }
  64:         recpos += cursor;
  65:         if(recpos >= curunit->url) err(errflag,F_EREREC,"dfe")
  66:     }
  67:     fseek(cf,(long)cursor,1);
  68:     return(cursor=0);
  69: }

Defined functions

c_dfe defined in line 15; used 2 times
y_tab defined in line 45; used 4 times
Last modified: 1987-02-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 873
Valid CSS Valid XHTML 1.0 Strict