conv_tab.c revision 1.4 1 /* $NetBSD: conv_tab.c,v 1.4 1995/03/21 09:04:03 cgd Exp $ */
2
3 /*-
4 * Copyright (c) 1991, 1993
5 * The Regents of the University of California. All rights reserved.
6 *
7 * This code is derived from software contributed to Berkeley by
8 * Keith Muller of the University of California, San Diego and Lance
9 * Visser of Convex Computer Corporation.
10 *
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
13 * are met:
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
19 * 3. All advertising materials mentioning features or use of this software
20 * must display the following acknowledgement:
21 * This product includes software developed by the University of
22 * California, Berkeley and its contributors.
23 * 4. Neither the name of the University nor the names of its contributors
24 * may be used to endorse or promote products derived from this software
25 * without specific prior written permission.
26 *
27 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
28 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
29 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
30 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
31 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
32 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
33 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
34 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
35 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
36 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
37 * SUCH DAMAGE.
38 */
39
40 #ifndef lint
41 #if 0
42 static char sccsid[] = "@(#)conv_tab.c 8.1 (Berkeley) 5/31/93";
43 #else
44 static char rcsid[] = "$NetBSD: conv_tab.c,v 1.4 1995/03/21 09:04:03 cgd Exp $";
45 #endif
46 #endif /* not lint */
47
48 #include <sys/types.h>
49
50 /*
51 * There are currently eight tables:
52 *
53 * lower-case -> upper-case conv=upper
54 * upper-case -> lower-case conv=lower
55 *
56 * ebcdic -> ascii 32V conv=oldascii
57 * ascii -> ebcdic 32V conv=oldebcdic
58 * ascii -> ibm ebcdic 32V conv=oldibm
59 *
60 * ebcdic -> ascii POSIX/S5 conv=ascii
61 * ascii -> ebcdic POSIX/S5 conv=ebcdic
62 * ascii -> ibm ebcdic POSIX/S5 conv=ibm
63 *
64 * Other tables are built from these if multiple conversions are being
65 * done.
66 *
67 * Tables used for conversions to/from IBM and EBCDIC to support an extension
68 * to POSIX P1003.2/D11. The tables referencing POSIX contain data extracted
69 * from tables 4-3 and 4-4 in P1003.2/Draft 11. The historic tables were
70 * constructed by running against a file with all possible byte values.
71 *
72 * More information can be obtained in "Correspondences of 8-Bit and Hollerith
73 * Codes for Computer Environments-A USASI Tutorial", Communications of the
74 * ACM, Volume 11, Number 11, November 1968, pp. 783-789.
75 */
76
77 /* Lower-case to upper-case */
78 u_char l2u[] = {
79 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, /* 0000 */
80 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017, /* 0010 */
81 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027, /* 0020 */
82 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037, /* 0030 */
83 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047, /* 0040 */
84 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057, /* 0050 */
85 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, /* 0060 */
86 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077, /* 0070 */
87 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107, /* 0100 */
88 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, /* 0110 */
89 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, /* 0120 */
90 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137, /* 0130 */
91 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107, /* 0140 */
92 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, /* 0150 */
93 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, /* 0160 */
94 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177, /* 0170 */
95 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207, /* 0200 */
96 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217, /* 0210 */
97 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227, /* 0220 */
98 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237, /* 0230 */
99 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247, /* 0240 */
100 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257, /* 0250 */
101 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0260 */
102 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0270 */
103 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307, /* 0300 */
104 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317, /* 0310 */
105 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327, /* 0320 */
106 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337, /* 0330 */
107 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347, /* 0340 */
108 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357, /* 0350 */
109 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0360 */
110 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
111 };
112
113 /* Upper-case to lower-case */
114 u_char u2l[] = {
115 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, /* 0000 */
116 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017, /* 0010 */
117 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027, /* 0020 */
118 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037, /* 0030 */
119 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047, /* 0040 */
120 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057, /* 0050 */
121 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, /* 0060 */
122 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077, /* 0070 */
123 0100, 0141, 0142, 0143, 0144, 0145, 0146, 0147, /* 0100 */
124 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157, /* 0110 */
125 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, /* 0120 */
126 0170, 0171, 0172, 0133, 0134, 0135, 0136, 0137, /* 0130 */
127 0140, 0141, 0142, 0143, 0144, 0145, 0146, 0147, /* 0140 */
128 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157, /* 0150 */
129 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, /* 0160 */
130 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177, /* 0170 */
131 0200, 0201, 0202, 0203, 0204, 0205, 0206, 0207, /* 0200 */
132 0210, 0211, 0212, 0213, 0214, 0215, 0216, 0217, /* 0210 */
133 0220, 0221, 0222, 0223, 0224, 0225, 0226, 0227, /* 0220 */
134 0230, 0231, 0232, 0233, 0234, 0235, 0236, 0237, /* 0230 */
135 0240, 0241, 0242, 0243, 0244, 0245, 0246, 0247, /* 0240 */
136 0250, 0251, 0252, 0253, 0254, 0255, 0256, 0257, /* 0250 */
137 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0260 */
138 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0270 */
139 0300, 0301, 0302, 0303, 0304, 0305, 0306, 0307, /* 0300 */
140 0310, 0311, 0312, 0313, 0314, 0315, 0316, 0317, /* 0310 */
141 0320, 0321, 0322, 0323, 0324, 0325, 0326, 0327, /* 0320 */
142 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337, /* 0330 */
143 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347, /* 0340 */
144 0350, 0351, 0352, 0353, 0354, 0355, 0356, 0357, /* 0350 */
145 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0360 */
146 0370, 0371, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
147 };
148
149 /* EBCDIC to ASCII -- 32V compatible. */
150 u_char e2a_32V[] = {
151 0000, 0001, 0002, 0003, 0234, 0011, 0206, 0177, /* 0000 */
152 0227, 0215, 0216, 0013, 0014, 0015, 0016, 0017, /* 0010 */
153 0020, 0021, 0022, 0023, 0235, 0205, 0010, 0207, /* 0020 */
154 0030, 0031, 0222, 0217, 0034, 0035, 0036, 0037, /* 0030 */
155 0200, 0201, 0202, 0203, 0204, 0012, 0027, 0033, /* 0040 */
156 0210, 0211, 0212, 0213, 0214, 0005, 0006, 0007, /* 0050 */
157 0220, 0221, 0026, 0223, 0224, 0225, 0226, 0004, /* 0060 */
158 0230, 0231, 0232, 0233, 0024, 0025, 0236, 0032, /* 0070 */
159 0040, 0240, 0241, 0242, 0243, 0244, 0245, 0246, /* 0100 */
160 0247, 0250, 0133, 0056, 0074, 0050, 0053, 0041, /* 0110 */
161 0046, 0251, 0252, 0253, 0254, 0255, 0256, 0257, /* 0120 */
162 0260, 0261, 0135, 0044, 0052, 0051, 0073, 0136, /* 0130 */
163 0055, 0057, 0262, 0263, 0264, 0265, 0266, 0267, /* 0140 */
164 0270, 0271, 0174, 0054, 0045, 0137, 0076, 0077, /* 0150 */
165 0272, 0273, 0274, 0275, 0276, 0277, 0300, 0301, /* 0160 */
166 0302, 0140, 0072, 0043, 0100, 0047, 0075, 0042, /* 0170 */
167 0303, 0141, 0142, 0143, 0144, 0145, 0146, 0147, /* 0200 */
168 0150, 0151, 0304, 0305, 0306, 0307, 0310, 0311, /* 0210 */
169 0312, 0152, 0153, 0154, 0155, 0156, 0157, 0160, /* 0220 */
170 0161, 0162, 0313, 0314, 0315, 0316, 0317, 0320, /* 0230 */
171 0321, 0176, 0163, 0164, 0165, 0166, 0167, 0170, /* 0240 */
172 0171, 0172, 0322, 0323, 0324, 0325, 0326, 0327, /* 0250 */
173 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337, /* 0260 */
174 0340, 0341, 0342, 0343, 0344, 0345, 0346, 0347, /* 0270 */
175 0173, 0101, 0102, 0103, 0104, 0105, 0106, 0107, /* 0300 */
176 0110, 0111, 0350, 0351, 0352, 0353, 0354, 0355, /* 0310 */
177 0175, 0112, 0113, 0114, 0115, 0116, 0117, 0120, /* 0320 */
178 0121, 0122, 0356, 0357, 0360, 0361, 0362, 0363, /* 0330 */
179 0134, 0237, 0123, 0124, 0125, 0126, 0127, 0130, /* 0340 */
180 0131, 0132, 0364, 0365, 0366, 0367, 0370, 0371, /* 0350 */
181 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, /* 0360 */
182 0070, 0071, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
183 };
184
185 /* ASCII to EBCDIC -- 32V compatible. */
186 u_char a2e_32V[] = {
187 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
188 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
189 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
190 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
191 0100, 0117, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
192 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
193 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
194 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */
195 0174, 0301, 0302, 0303, 0304, 0305, 0306, 0307, /* 0100 */
196 0310, 0311, 0321, 0322, 0323, 0324, 0325, 0326, /* 0110 */
197 0327, 0330, 0331, 0342, 0343, 0344, 0345, 0346, /* 0120 */
198 0347, 0350, 0351, 0112, 0340, 0132, 0137, 0155, /* 0130 */
199 0171, 0201, 0202, 0203, 0204, 0205, 0206, 0207, /* 0140 */
200 0210, 0211, 0221, 0222, 0223, 0224, 0225, 0226, /* 0150 */
201 0227, 0230, 0231, 0242, 0243, 0244, 0245, 0246, /* 0160 */
202 0247, 0250, 0251, 0300, 0152, 0320, 0241, 0007, /* 0170 */
203 0040, 0041, 0042, 0043, 0044, 0025, 0006, 0027, /* 0200 */
204 0050, 0051, 0052, 0053, 0054, 0011, 0012, 0033, /* 0210 */
205 0060, 0061, 0032, 0063, 0064, 0065, 0066, 0010, /* 0220 */
206 0070, 0071, 0072, 0073, 0004, 0024, 0076, 0341, /* 0230 */
207 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, /* 0240 */
208 0111, 0121, 0122, 0123, 0124, 0125, 0126, 0127, /* 0250 */
209 0130, 0131, 0142, 0143, 0144, 0145, 0146, 0147, /* 0260 */
210 0150, 0151, 0160, 0161, 0162, 0163, 0164, 0165, /* 0270 */
211 0166, 0167, 0170, 0200, 0212, 0213, 0214, 0215, /* 0300 */
212 0216, 0217, 0220, 0232, 0233, 0234, 0235, 0236, /* 0310 */
213 0237, 0240, 0252, 0253, 0254, 0255, 0256, 0257, /* 0320 */
214 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
215 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0340 */
216 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
217 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
218 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
219 };
220
221 /* ASCII to IBM EBCDIC -- 32V compatible. */
222 u_char a2ibm_32V[] = {
223 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
224 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
225 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
226 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
227 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
228 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
229 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
230 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */
231 0174, 0301, 0302, 0303, 0304, 0305, 0306, 0307, /* 0100 */
232 0310, 0311, 0321, 0322, 0323, 0324, 0325, 0326, /* 0110 */
233 0327, 0330, 0331, 0342, 0343, 0344, 0345, 0346, /* 0120 */
234 0347, 0350, 0351, 0255, 0340, 0275, 0137, 0155, /* 0130 */
235 0171, 0201, 0202, 0203, 0204, 0205, 0206, 0207, /* 0140 */
236 0210, 0211, 0221, 0222, 0223, 0224, 0225, 0226, /* 0150 */
237 0227, 0230, 0231, 0242, 0243, 0244, 0245, 0246, /* 0160 */
238 0247, 0250, 0251, 0300, 0117, 0320, 0241, 0007, /* 0170 */
239 0040, 0041, 0042, 0043, 0044, 0025, 0006, 0027, /* 0200 */
240 0050, 0051, 0052, 0053, 0054, 0011, 0012, 0033, /* 0210 */
241 0060, 0061, 0032, 0063, 0064, 0065, 0066, 0010, /* 0220 */
242 0070, 0071, 0072, 0073, 0004, 0024, 0076, 0341, /* 0230 */
243 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, /* 0240 */
244 0111, 0121, 0122, 0123, 0124, 0125, 0126, 0127, /* 0250 */
245 0130, 0131, 0142, 0143, 0144, 0145, 0146, 0147, /* 0260 */
246 0150, 0151, 0160, 0161, 0162, 0163, 0164, 0165, /* 0270 */
247 0166, 0167, 0170, 0200, 0212, 0213, 0214, 0215, /* 0300 */
248 0216, 0217, 0220, 0232, 0233, 0234, 0235, 0236, /* 0310 */
249 0237, 0240, 0252, 0253, 0254, 0255, 0256, 0257, /* 0320 */
250 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
251 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0340 */
252 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
253 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
254 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
255 };
256
257 /* EBCDIC to ASCII -- POSIX and System V compatible. */
258 u_char e2a_POSIX[] = {
259 0000, 0001, 0002, 0003, 0234, 0011, 0206, 0177, /* 0000 */
260 0227, 0215, 0216, 0013, 0014, 0015, 0016, 0017, /* 0010 */
261 0020, 0021, 0022, 0023, 0235, 0205, 0010, 0207, /* 0020 */
262 0030, 0031, 0222, 0217, 0034, 0035, 0036, 0037, /* 0030 */
263 0200, 0201, 0202, 0203, 0204, 0012, 0027, 0033, /* 0040 */
264 0210, 0211, 0212, 0213, 0214, 0005, 0006, 0007, /* 0050 */
265 0220, 0221, 0026, 0223, 0224, 0225, 0226, 0004, /* 0060 */
266 0230, 0231, 0232, 0233, 0024, 0025, 0236, 0032, /* 0070 */
267 0040, 0240, 0241, 0242, 0243, 0244, 0245, 0246, /* 0100 */
268 0247, 0250, 0325, 0056, 0074, 0050, 0053, 0174, /* 0110 */
269 0046, 0251, 0252, 0253, 0254, 0255, 0256, 0257, /* 0120 */
270 0260, 0261, 0041, 0044, 0052, 0051, 0073, 0176, /* 0130 */
271 0055, 0057, 0262, 0263, 0264, 0265, 0266, 0267, /* 0140 */
272 0270, 0271, 0313, 0054, 0045, 0137, 0076, 0077, /* 0150 */
273 0272, 0273, 0274, 0275, 0276, 0277, 0300, 0301, /* 0160 */
274 0302, 0140, 0072, 0043, 0100, 0047, 0075, 0042, /* 0170 */
275 0303, 0141, 0142, 0143, 0144, 0145, 0146, 0147, /* 0200 */
276 0150, 0151, 0304, 0305, 0306, 0307, 0310, 0311, /* 0210 */
277 0312, 0152, 0153, 0154, 0155, 0156, 0157, 0160, /* 0220 */
278 0161, 0162, 0136, 0314, 0315, 0316, 0317, 0320, /* 0230 */
279 0321, 0345, 0163, 0164, 0165, 0166, 0167, 0170, /* 0240 */
280 0171, 0172, 0322, 0323, 0324, 0133, 0326, 0327, /* 0250 */
281 0330, 0331, 0332, 0333, 0334, 0335, 0336, 0337, /* 0260 */
282 0340, 0341, 0342, 0343, 0344, 0135, 0346, 0347, /* 0270 */
283 0173, 0101, 0102, 0103, 0104, 0105, 0106, 0107, /* 0300 */
284 0110, 0111, 0350, 0351, 0352, 0353, 0354, 0355, /* 0310 */
285 0175, 0112, 0113, 0114, 0115, 0116, 0117, 0120, /* 0320 */
286 0121, 0122, 0356, 0357, 0360, 0361, 0362, 0363, /* 0330 */
287 0134, 0237, 0123, 0124, 0125, 0126, 0127, 0130, /* 0340 */
288 0131, 0132, 0364, 0365, 0366, 0367, 0370, 0371, /* 0350 */
289 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, /* 0360 */
290 0070, 0071, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
291 };
292
293 /* ASCII to EBCDIC -- POSIX and System V compatible. */
294 u_char a2e_POSIX[] = {
295 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
296 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
297 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
298 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
299 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
300 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
301 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
302 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */
303 0174, 0301, 0302, 0303, 0304, 0305, 0306, 0307, /* 0100 */
304 0310, 0311, 0321, 0322, 0323, 0324, 0325, 0326, /* 0110 */
305 0327, 0330, 0331, 0342, 0343, 0344, 0345, 0346, /* 0120 */
306 0347, 0350, 0351, 0255, 0340, 0275, 0232, 0155, /* 0130 */
307 0171, 0201, 0202, 0203, 0204, 0205, 0206, 0207, /* 0140 */
308 0210, 0211, 0221, 0222, 0223, 0224, 0225, 0226, /* 0150 */
309 0227, 0230, 0231, 0242, 0243, 0244, 0245, 0246, /* 0160 */
310 0247, 0250, 0251, 0300, 0117, 0320, 0137, 0007, /* 0170 */
311 0040, 0041, 0042, 0043, 0044, 0025, 0006, 0027, /* 0200 */
312 0050, 0051, 0052, 0053, 0054, 0011, 0012, 0033, /* 0210 */
313 0060, 0061, 0032, 0063, 0064, 0065, 0066, 0010, /* 0220 */
314 0070, 0071, 0072, 0073, 0004, 0024, 0076, 0341, /* 0230 */
315 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, /* 0240 */
316 0111, 0121, 0122, 0123, 0124, 0125, 0126, 0127, /* 0250 */
317 0130, 0131, 0142, 0143, 0144, 0145, 0146, 0147, /* 0260 */
318 0150, 0151, 0160, 0161, 0162, 0163, 0164, 0165, /* 0270 */
319 0166, 0167, 0170, 0200, 0212, 0213, 0214, 0215, /* 0300 */
320 0216, 0217, 0220, 0152, 0233, 0234, 0235, 0236, /* 0310 */
321 0237, 0240, 0252, 0253, 0254, 0112, 0256, 0257, /* 0320 */
322 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
323 0270, 0271, 0272, 0273, 0274, 0241, 0276, 0277, /* 0340 */
324 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
325 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
326 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
327 };
328
329 /* ASCII to IBM EBCDIC -- POSIX and System V compatible. */
330 u_char a2ibm_POSIX[] = {
331 0000, 0001, 0002, 0003, 0067, 0055, 0056, 0057, /* 0000 */
332 0026, 0005, 0045, 0013, 0014, 0015, 0016, 0017, /* 0010 */
333 0020, 0021, 0022, 0023, 0074, 0075, 0062, 0046, /* 0020 */
334 0030, 0031, 0077, 0047, 0034, 0035, 0036, 0037, /* 0030 */
335 0100, 0132, 0177, 0173, 0133, 0154, 0120, 0175, /* 0040 */
336 0115, 0135, 0134, 0116, 0153, 0140, 0113, 0141, /* 0050 */
337 0360, 0361, 0362, 0363, 0364, 0365, 0366, 0367, /* 0060 */
338 0370, 0371, 0172, 0136, 0114, 0176, 0156, 0157, /* 0070 */
339 0174, 0301, 0302, 0303, 0304, 0305, 0306, 0307, /* 0100 */
340 0310, 0311, 0321, 0322, 0323, 0324, 0325, 0326, /* 0110 */
341 0327, 0330, 0331, 0342, 0343, 0344, 0345, 0346, /* 0120 */
342 0347, 0350, 0351, 0255, 0340, 0275, 0137, 0155, /* 0130 */
343 0171, 0201, 0202, 0203, 0204, 0205, 0206, 0207, /* 0140 */
344 0210, 0211, 0221, 0222, 0223, 0224, 0225, 0226, /* 0150 */
345 0227, 0230, 0231, 0242, 0243, 0244, 0245, 0246, /* 0160 */
346 0247, 0250, 0251, 0300, 0117, 0320, 0241, 0007, /* 0170 */
347 0040, 0041, 0042, 0043, 0044, 0025, 0006, 0027, /* 0200 */
348 0050, 0051, 0052, 0053, 0054, 0011, 0012, 0033, /* 0210 */
349 0060, 0061, 0032, 0063, 0064, 0065, 0066, 0010, /* 0220 */
350 0070, 0071, 0072, 0073, 0004, 0024, 0076, 0341, /* 0230 */
351 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, /* 0240 */
352 0111, 0121, 0122, 0123, 0124, 0125, 0126, 0127, /* 0250 */
353 0130, 0131, 0142, 0143, 0144, 0145, 0146, 0147, /* 0260 */
354 0150, 0151, 0160, 0161, 0162, 0163, 0164, 0165, /* 0270 */
355 0166, 0167, 0170, 0200, 0212, 0213, 0214, 0215, /* 0300 */
356 0216, 0217, 0220, 0232, 0233, 0234, 0235, 0236, /* 0310 */
357 0237, 0240, 0252, 0253, 0254, 0255, 0256, 0257, /* 0320 */
358 0260, 0261, 0262, 0263, 0264, 0265, 0266, 0267, /* 0330 */
359 0270, 0271, 0272, 0273, 0274, 0275, 0276, 0277, /* 0340 */
360 0312, 0313, 0314, 0315, 0316, 0317, 0332, 0333, /* 0350 */
361 0334, 0335, 0336, 0337, 0352, 0353, 0354, 0355, /* 0360 */
362 0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377, /* 0370 */
363 };
364