home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / bin / dd / conv_tab.c < prev    next >
Encoding:
C/C++ Source or Header  |  1993-02-24  |  18.8 KB  |  358 lines

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