9 date 92.12.15.00.20.22; author jromine; state Exp;
14 date 92.01.31.21.48.21; author jromine; state Exp;
19 date 92.01.31.21.47.47; author jromine; state Exp;
24 date 92.01.31.21.47.44; author jromine; state Exp;
38 @/* cpydgst.c - copy from one fd to another in encapsulating mode */
40 static char ident[] = "@@(#)$Id: cpydgst.c,v 1.3 1992/01/31 21:48:21 jromine Exp jromine $";
47 /* All we want to do is to perform the substitution
49 \n(-.*)\n --> \n- \1\n
53 sed -e 's%^-%- -%' < ifile > ofile
55 to do this, but the routine below is faster than the pipe, fork, and
62 #define output(c) if (bp >= dp) {flush(); *bp++ = c;} else *bp++ = c
63 #define flush() if ((j = bp - outbuf) && write (out, outbuf, j) != j) \
64 adios (ofile, "error writing"); \
70 void cpydgst (in, out, ifile, ofile)
86 dp = (bp = outbuf) + sizeof outbuf;
87 for (state = S1; (i = read (in, buffer, sizeof buffer)) > 0;)
88 for (ep = (cp = buffer) + i; cp < ep; cp++) {
97 state = S2; /* fall */
108 adios (ifile, "error reading");
121 static char ident[] = "@@(#)$Id: m_getfld.c,v 1.9 1992/01/24 18:03:41 jromine Exp $";