Deleted Added
full compact
conv_tab.c (50471) conv_tab.c (51208)
1/*-
2 * Copyright (c) 1991, 1993
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 *

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

35 * SUCH DAMAGE.
36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)conv_tab.c 8.1 (Berkeley) 5/31/93";
41#endif
42static const char rcsid[] =
1/*-
2 * Copyright (c) 1991, 1993
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 *

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

35 * SUCH DAMAGE.
36 */
37
38#ifndef lint
39#if 0
40static char sccsid[] = "@(#)conv_tab.c 8.1 (Berkeley) 5/31/93";
41#endif
42static const char rcsid[] =
43 "$FreeBSD: head/bin/dd/conv_tab.c 50471 1999-08-27 23:15:48Z peter $";
43 "$FreeBSD: head/bin/dd/conv_tab.c 51208 1999-09-12 16:51:53Z green $";
44#endif /* not lint */
45
46#include <sys/types.h>
47
48/*
44#endif /* not lint */
45
46#include <sys/types.h>
47
48/*
49 * There are currently eight tables:
49 * There are currently six tables:
50 *
50 *
51 * lower-case -> upper-case conv=upper
52 * upper-case -> lower-case conv=lower
53 *
54 * ebcdic -> ascii 32V conv=oldascii
55 * ascii -> ebcdic 32V conv=oldebcdic
56 * ascii -> ibm ebcdic 32V conv=oldibm
57 *
58 * ebcdic -> ascii POSIX/S5 conv=ascii
59 * ascii -> ebcdic POSIX/S5 conv=ebcdic
60 * ascii -> ibm ebcdic POSIX/S5 conv=ibm
61 *

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

67 * from tables 4-3 and 4-4 in P1003.2/Draft 11. The historic tables were
68 * constructed by running against a file with all possible byte values.
69 *
70 * More information can be obtained in "Correspondences of 8-Bit and Hollerith
71 * Codes for Computer Environments-A USASI Tutorial", Communications of the
72 * ACM, Volume 11, Number 11, November 1968, pp. 783-789.
73 */
74
51 * ebcdic -> ascii 32V conv=oldascii
52 * ascii -> ebcdic 32V conv=oldebcdic
53 * ascii -> ibm ebcdic 32V conv=oldibm
54 *
55 * ebcdic -> ascii POSIX/S5 conv=ascii
56 * ascii -> ebcdic POSIX/S5 conv=ebcdic
57 * ascii -> ibm ebcdic POSIX/S5 conv=ibm
58 *

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

64 * from tables 4-3 and 4-4 in P1003.2/Draft 11. The historic tables were
65 * constructed by running against a file with all possible byte values.
66 *
67 * More information can be obtained in "Correspondences of 8-Bit and Hollerith
68 * Codes for Computer Environments-A USASI Tutorial", Communications of the
69 * ACM, Volume 11, Number 11, November 1968, pp. 783-789.
70 */
71
75/* Lower-case to upper-case */
76u_char l2u[256];
72u_char casetab[256];
77
73
78/* Upper-case to lower-case */
79u_char u2l[256];
80
81/* EBCDIC to ASCII -- 32V compatible. */
74/* EBCDIC to ASCII -- 32V compatible. */
82u_char e2a_32V[] = {
75const u_char e2a_32V[] = {
83 0000, 0001, 0002, 0003, 0234, 0011, 0206, 0177, /* 0000 */
84 0227, 0215, 0216, 0013, 0014, 0015, 0016, 0017, /* 0010 */
85 0020, 0021, 0022, 0023, 0235, 0205, 0010, 0207, /* 0020 */
86 0030, 0031, 0222, 0217, 0034, 0035, 0036, 0037, /* 0030 */
87 0200, 0201, 0202, 0203, 0204, 0012, 0027, 0033, /* 0040 */
88 0210, 0211, 0212, 0213, 0214, 0005, 0006, 0007, /* 0050 */
89 0220, 0221, 0026, 0223, 0224, 0225, 0226, 0004, /* 0060 */
90 0230, 0231, 0232, 0233, 0024, 0025, 0236, 0032, /* 0070 */

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

110 0121, 0122, 0356, 0357, 0360, 0361, 0362, 0363, /* 0330 */
111 0134, 0237, 0123, 0124, 0125, 0126, 0127, 0130, /* 0340 */
112 0131, 0132, 0364, 0365, 0366, 0367, 0370, 0371, /* 0350 */
113 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, /* 0360 */
114 0070, 0071, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
115};
116
117/* ASCII to EBCDIC -- 32V compatible. */
76 0000, 0001, 0002, 0003, 0234, 0011, 0206, 0177, /* 0000 */
77 0227, 0215, 0216, 0013, 0014, 0015, 0016, 0017, /* 0010 */
78 0020, 0021, 0022, 0023, 0235, 0205, 0010, 0207, /* 0020 */
79 0030, 0031, 0222, 0217, 0034, 0035, 0036, 0037, /* 0030 */
80 0200, 0201, 0202, 0203, 0204, 0012, 0027, 0033, /* 0040 */
81 0210, 0211, 0212, 0213, 0214, 0005, 0006, 0007, /* 0050 */
82 0220, 0221, 0026, 0223, 0224, 0225, 0226, 0004, /* 0060 */
83 0230, 0231, 0232, 0233, 0024, 0025, 0236, 0032, /* 0070 */

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

103 0121, 0122, 0356, 0357, 0360, 0361, 0362, 0363, /* 0330 */
104 0134, 0237, 0123, 0124, 0125, 0126, 0127, 0130, /* 0340 */
105 0131, 0132, 0364, 0365, 0366, 0367, 0370, 0371, /* 0350 */
106 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, /* 0360 */
107 0070, 0071, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
108};
109
110/* ASCII to EBCDIC -- 32V compatible. */
118u_char a2e_32V[] = {
111const u_char a2e_32V[] = {
119 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
120 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
121 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
122 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
123 0100, 0117, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
124 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
125 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
126 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */

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

146 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
147 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0340 */
148 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
149 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
150 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
151};
152
153/* ASCII to IBM EBCDIC -- 32V compatible. */
112 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
113 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
114 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
115 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
116 0100, 0117, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
117 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
118 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
119 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */

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

139 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
140 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0340 */
141 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
142 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
143 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
144};
145
146/* ASCII to IBM EBCDIC -- 32V compatible. */
154u_char a2ibm_32V[] = {
147const u_char a2ibm_32V[] = {
155 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
156 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
157 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
158 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
159 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
160 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
161 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
162 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */

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

182 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
183 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0340 */
184 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
185 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
186 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
187};
188
189/* EBCDIC to ASCII -- POSIX and System V compatible. */
148 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
149 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
150 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
151 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
152 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
153 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
154 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
155 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */

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

175 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
176 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0340 */
177 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
178 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
179 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
180};
181
182/* EBCDIC to ASCII -- POSIX and System V compatible. */
190u_char e2a_POSIX[] = {
183const u_char e2a_POSIX[] = {
191 0000, 0001, 0002, 0003, 0234, 0011, 0206, 0177, /* 0000 */
192 0227, 0215, 0216, 0013, 0014, 0015, 0016, 0017, /* 0010 */
193 0020, 0021, 0022, 0023, 0235, 0205, 0010, 0207, /* 0020 */
194 0030, 0031, 0222, 0217, 0034, 0035, 0036, 0037, /* 0030 */
195 0200, 0201, 0202, 0203, 0204, 0012, 0027, 0033, /* 0040 */
196 0210, 0211, 0212, 0213, 0214, 0005, 0006, 0007, /* 0050 */
197 0220, 0221, 0026, 0223, 0224, 0225, 0226, 0004, /* 0060 */
198 0230, 0231, 0232, 0233, 0024, 0025, 0236, 0032, /* 0070 */

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

218 0121, 0122, 0356, 0357, 0360, 0361, 0362, 0363, /* 0330 */
219 0134, 0237, 0123, 0124, 0125, 0126, 0127, 0130, /* 0340 */
220 0131, 0132, 0364, 0365, 0366, 0367, 0370, 0371, /* 0350 */
221 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, /* 0360 */
222 0070, 0071, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
223};
224
225/* ASCII to EBCDIC -- POSIX and System V compatible. */
184 0000, 0001, 0002, 0003, 0234, 0011, 0206, 0177, /* 0000 */
185 0227, 0215, 0216, 0013, 0014, 0015, 0016, 0017, /* 0010 */
186 0020, 0021, 0022, 0023, 0235, 0205, 0010, 0207, /* 0020 */
187 0030, 0031, 0222, 0217, 0034, 0035, 0036, 0037, /* 0030 */
188 0200, 0201, 0202, 0203, 0204, 0012, 0027, 0033, /* 0040 */
189 0210, 0211, 0212, 0213, 0214, 0005, 0006, 0007, /* 0050 */
190 0220, 0221, 0026, 0223, 0224, 0225, 0226, 0004, /* 0060 */
191 0230, 0231, 0232, 0233, 0024, 0025, 0236, 0032, /* 0070 */

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

211 0121, 0122, 0356, 0357, 0360, 0361, 0362, 0363, /* 0330 */
212 0134, 0237, 0123, 0124, 0125, 0126, 0127, 0130, /* 0340 */
213 0131, 0132, 0364, 0365, 0366, 0367, 0370, 0371, /* 0350 */
214 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, /* 0360 */
215 0070, 0071, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
216};
217
218/* ASCII to EBCDIC -- POSIX and System V compatible. */
226u_char a2e_POSIX[] = {
219const u_char a2e_POSIX[] = {
227 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
228 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
229 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
230 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
231 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
232 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
233 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
234 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */

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

254 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
255 0270, 0271, 0272, 0273, 0274, 0241, 0276, 0277, /* 0340 */
256 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
257 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
258 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
259};
260
261/* ASCII to IBM EBCDIC -- POSIX and System V compatible. */
220 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
221 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
222 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
223 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
224 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
225 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
226 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
227 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */

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

247 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
248 0270, 0271, 0272, 0273, 0274, 0241, 0276, 0277, /* 0340 */
249 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
250 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
251 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
252};
253
254/* ASCII to IBM EBCDIC -- POSIX and System V compatible. */
262u_char a2ibm_POSIX[] = {
255const u_char a2ibm_POSIX[] = {
263 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
264 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
265 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
266 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
267 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
268 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
269 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
270 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */

--- 25 unchanged lines hidden ---
256 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
257 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
258 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
259 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
260 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
261 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
262 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
263 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */

--- 25 unchanged lines hidden ---