Deleted Added
full compact
conv.c (1557) conv.c (2923)
1/*-
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Keith Muller of the University of California, San Diego and Lance
7 * Visser of Convex Computer Corporation.
8 *

--- 45 unchanged lines hidden (view full) ---

54 * Worst case buffer calculation is (ibs + obs - 1).
55 */
56void
57def()
58{
59 int cnt;
60 u_char *inp, *t;
61
1/*-
2 * Copyright (c) 1991, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Keith Muller of the University of California, San Diego and Lance
7 * Visser of Convex Computer Corporation.
8 *

--- 45 unchanged lines hidden (view full) ---

54 * Worst case buffer calculation is (ibs + obs - 1).
55 */
56void
57def()
58{
59 int cnt;
60 u_char *inp, *t;
61
62 if (t = ctab)
62 if ((t = ctab))
63 for (inp = in.dbp - (cnt = in.dbrcnt); cnt--; ++inp)
64 *inp = t[*inp];
65
66 /* Make the output buffer look right. */
67 out.dbp = in.dbp;
68 out.dbcnt = in.dbcnt;
69
70 if (in.dbcnt >= out.dbsz) {

--- 27 unchanged lines hidden (view full) ---

98 */
99void
100block()
101{
102 static int intrunc;
103 int ch, cnt, maxlen;
104 u_char *inp, *outp, *t;
105
63 for (inp = in.dbp - (cnt = in.dbrcnt); cnt--; ++inp)
64 *inp = t[*inp];
65
66 /* Make the output buffer look right. */
67 out.dbp = in.dbp;
68 out.dbcnt = in.dbcnt;
69
70 if (in.dbcnt >= out.dbsz) {

--- 27 unchanged lines hidden (view full) ---

98 */
99void
100block()
101{
102 static int intrunc;
103 int ch, cnt, maxlen;
104 u_char *inp, *outp, *t;
105
106 ch = 0;
106 /*
107 * Record truncation can cross block boundaries. If currently in a
108 * truncation state, keep tossing characters until reach a newline.
109 * Start at the beginning of the buffer, as the input buffer is always
110 * left empty.
111 */
112 if (intrunc) {
113 for (inp = in.db, cnt = in.dbrcnt;

--- 10 unchanged lines hidden (view full) ---

124 }
125
126 /*
127 * Copy records (max cbsz size chunks) into the output buffer. The
128 * translation is done as we copy into the output buffer.
129 */
130 for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) {
131 maxlen = MIN(cbsz, in.dbcnt);
107 /*
108 * Record truncation can cross block boundaries. If currently in a
109 * truncation state, keep tossing characters until reach a newline.
110 * Start at the beginning of the buffer, as the input buffer is always
111 * left empty.
112 */
113 if (intrunc) {
114 for (inp = in.db, cnt = in.dbrcnt;

--- 10 unchanged lines hidden (view full) ---

125 }
126
127 /*
128 * Copy records (max cbsz size chunks) into the output buffer. The
129 * translation is done as we copy into the output buffer.
130 */
131 for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) {
132 maxlen = MIN(cbsz, in.dbcnt);
132 if (t = ctab)
133 if ((t = ctab))
133 for (cnt = 0;
134 cnt < maxlen && (ch = *inp++) != '\n'; ++cnt)
135 *outp++ = t[ch];
136 else
137 for (cnt = 0;
138 cnt < maxlen && (ch = *inp++) != '\n'; ++cnt)
139 *outp++ = ch;
140 /*

--- 67 unchanged lines hidden (view full) ---

208 */
209void
210unblock()
211{
212 int cnt;
213 u_char *inp, *t;
214
215 /* Translation and case conversion. */
134 for (cnt = 0;
135 cnt < maxlen && (ch = *inp++) != '\n'; ++cnt)
136 *outp++ = t[ch];
137 else
138 for (cnt = 0;
139 cnt < maxlen && (ch = *inp++) != '\n'; ++cnt)
140 *outp++ = ch;
141 /*

--- 67 unchanged lines hidden (view full) ---

209 */
210void
211unblock()
212{
213 int cnt;
214 u_char *inp, *t;
215
216 /* Translation and case conversion. */
216 if (t = ctab)
217 if ((t = ctab))
217 for (cnt = in.dbrcnt, inp = in.dbp; cnt--;)
218 *--inp = t[*inp];
219 /*
220 * Copy records (max cbsz size chunks) into the output buffer. The
221 * translation has to already be done or we might not recognize the
222 * spaces.
223 */
224 for (inp = in.db; in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) {

--- 36 unchanged lines hidden ---
218 for (cnt = in.dbrcnt, inp = in.dbp; cnt--;)
219 *--inp = t[*inp];
220 /*
221 * Copy records (max cbsz size chunks) into the output buffer. The
222 * translation has to already be done or we might not recognize the
223 * spaces.
224 */
225 for (inp = in.db; in.dbcnt >= cbsz; inp += cbsz, in.dbcnt -= cbsz) {

--- 36 unchanged lines hidden ---