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:  *	@(#)wsfe.c	5.2	7/30/85
   7:  */
   8: 
   9: /*
  10:  * write sequential formatted external
  11:  */
  12: 
  13: #include "fio.h"
  14: 
  15: LOCAL char wsfe[] = "write sfe";
  16: 
  17: extern int w_ed(),w_ned();
  18: int x_putc(),pr_put(),x_wend(),x_wnew(),x_tab();
  19: LOCAL ioflag new;
  20: 
  21: s_wsfe(a) cilist *a;    /*start*/
  22: {   int n;
  23:     reading = NO;
  24:     sequential = YES;
  25:     if(n=c_sfe(a,WRITE,SEQ,wsfe)) return(n);
  26:     if(curunit->url) err(errflag,F_ERNOSIO,wsfe)
  27:     if(!curunit->uwrt && ! nowwriting(curunit)) err(errflag, errno, wsfe)
  28:     curunit->uend = NO;
  29:     if (curunit->uprnt) putn = pr_put;
  30:     else putn = x_putc;
  31:     new = YES;
  32:     doed= w_ed;
  33:     doned= w_ned;
  34:     doend = x_wend;
  35:     dorevert = donewrec = x_wnew;
  36:     dotab = x_tab;
  37:     if(pars_f()) err(errflag,F_ERFMT,wsfe)
  38:     fmt_bg();
  39:     return(OK);
  40: }
  41: 
  42: LOCAL
  43: x_putc(c)
  44: {
  45:     if(c=='\n') recpos = reclen = cursor = 0;
  46:     else recpos++;
  47:     if (c) putc(c,cf);
  48:     return(OK);
  49: }
  50: 
  51: LOCAL
  52: pr_put(c)
  53: {
  54:     if(c=='\n')
  55:     {   new = YES;
  56:         recpos = reclen = cursor = 0;
  57:     }
  58:     else if(new)
  59:     {   new = NO;
  60:         if(c=='0') c = '\n';
  61:         else if(c=='1') c = '\f';
  62:         else return(OK);
  63:     }
  64:     else recpos++;
  65:     if (c) putc(c,cf);
  66:     return(OK);
  67: }
  68: 
  69: LOCAL
  70: x_wnew()
  71: {
  72:     if(reclen>recpos) fseek(cf,(long)(reclen-recpos),1);
  73:     return((*putn)('\n'));
  74: }
  75: 
  76: LOCAL
  77: x_wend(last) char last;
  78: {
  79:     if(reclen>recpos) fseek(cf,(long)(reclen-recpos),1);
  80:     return((*putn)(last));
  81: }
  82: 
  83: e_wsfe()
  84: {   int n;
  85:     n=en_fio();
  86:     fmtbuf=NULL;
  87:     return(n);
  88: }

Defined functions

e_wsfe defined in line 83; never used
pr_put defined in line 51; used 2 times
s_wsfe defined in line 21; never used
x_putc defined in line 42; used 2 times
x_wend defined in line 76; used 2 times
x_wnew defined in line 69; used 2 times

Defined variables

new defined in line 19; used 4 times
wsfe defined in line 15; used 4 times
Last modified: 1987-02-18
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 2334
Valid CSS Valid XHTML 1.0 Strict