1: /* 2: char id_wiio[] = "@(#)wiio.c 1.1"; 3: * 4: * write internal (character array) i/o 5: */ 6: 7: #include "fio.h" 8: #include "lio.h" 9: 10: int z_wnew(), z_tab(); 11: extern int w_ed(), w_ned(), l_write(); 12: 13: z_putc(c) char c; 14: { 15: if(icptr < icend) 16: { if(c=='\n') return(z_wnew()); 17: if(recpos++ < svic->icirlen) 18: { *icptr++ = c; 19: return(OK); 20: } 21: else err(errflag,F_EREREC,"iio") 22: } 23: leof = EOF; 24: #ifndef KOSHER 25: err(endflag,EOF,"iio") /* NOT STANDARD, end-of-file on writes */ 26: #endif 27: #ifdef KOSHER 28: err(errflag,F_EREREC,"iio") 29: #endif 30: } 31: 32: s_wsfi(a) icilist *a; 33: { 34: reading = NO; 35: doed=w_ed; 36: doned=w_ned; 37: putn=z_putc; 38: doend = donewrec = z_wnew; 39: dorevert = z_wnew; 40: dotab = z_tab; 41: return(c_si(a)); 42: } 43: 44: s_wdfi(a) icilist *a; 45: { 46: reading = NO; 47: doed = w_ed; 48: doned = w_ned; 49: putn = z_putc; 50: donewrec = z_wnew; 51: dorevert = doend = z_wnew; 52: dotab = z_tab; 53: return(c_di(a)); 54: } 55: 56: z_wnew() 57: { 58: if(reclen > recpos) 59: { icptr += (reclen - recpos); 60: recpos = reclen; 61: } 62: while(recpos < svic->icirlen) (*putn)(' '); 63: recpos = reclen = cursor = 0; 64: recnum++; 65: return(OK); 66: } 67: 68: e_wsfi() 69: { 70: return(e_rsfi()); 71: } 72: 73: e_wdfi() 74: { 75: return(e_wsfi()); 76: } 77: 78: s_wsli(a) icilist *a; 79: { 80: reading = NO; 81: putn = z_putc; 82: lioproc = l_write; 83: line_len = a->icirlen; 84: return(c_li(a)); 85: } 86: 87: e_wsli() 88: { fmtbuf = NULL; 89: reclen = recpos; 90: return(z_wnew()); 91: }