/* char id_dfe[] = "@(#)dfe.c 1.4"; * * direct formatted external i/o */ #include "fio.h" extern int rd_ed(),rd_ned(),w_ed(),w_ned(); int y_tab(); extern char rdfe[]; extern char wdfe[]; e_rdfe() { en_fio(); return(OK); } e_wdfe() { en_fio(); return(OK); } c_dfe(a,flag) cilist *a; { int n; sequential = NO; external = formatted = FORMATTED; lfname = NULL; elist = NO; cursor=scale=recpos=reclen=0; radix = 10; signit = YES; fmtbuf = a->cifmt; errflag = a->cierr; endflag = a->ciend; lunit = a->ciunit; if(not_legal(lunit)) err(errflag,F_ERUNIT,rdfe+5); curunit = &units[lunit]; if(!curunit->ufd && (n=fk_open(flag,DIR,FMT,(ftnint)lunit))) err(errflag,n,rdfe+5) cf = curunit->ufd; elist = YES; lfname = curunit->ufnm; if(!curunit->ufmt) err(errflag,F_ERNOFIO,rdfe+5) if(!curunit->useek || !curunit->url) err(errflag,F_ERNODIO,rdfe+5) recnum = a->cirec - 1; fseek(cf, (long)curunit->url * recnum, 0); cblank = curunit->ublnk; cplus = NO; return(OK); } y_tab() { int n; if(curunit->url==1) { if(cursor < 0 && -cursor > ftell(cf)) rewind(cf); else fseek(cf,(long)cursor,1); return(cursor=0); } else { if(reclen < recpos) reclen = recpos; if((recpos + cursor) < 0) cursor = -recpos; /* BOR */ n = reclen - recpos; /* n >= 0 */ if(!reading && (cursor-n) > 0) { recpos = reclen; cursor -= n; fseek(cf,(long)n,1); while(cursor--) if(n=(*putn)(' ')) return(n); return(cursor=0); } recpos += cursor; if(recpos >= curunit->url) err(errflag,F_EREREC,rdfe+5) } fseek(cf,(long)cursor,1); return(cursor=0); } /* /*y_rev() /*{ /*what about work done?*/ /* if(curunit->url==1) return(0); /* while(recposurl) (*putn)(' '); /* recpos=0; /* return(0); /*} /* /*y_err() /*{ /* err(errflag, F_EREREC, rdfe+5); /*} */