1 /*
   2  * Copyright (c) 1992, 1993, 1994 Henry Spencer.
   3  * Copyright (c) 1992, 1993, 1994
   4  *      The Regents of the University of California.  All rights reserved.
   5  *
   6  * This code is derived from software contributed to Berkeley by
   7  * Henry Spencer.
   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. Neither the name of the University nor the names of its contributors
  18  *    may be used to endorse or promote products derived from this software
  19  *    without specific prior written permission.
  20  *
  21  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
  22  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  23  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  24  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
  25  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  26  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
  27  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
  28  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  29  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
  30  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  31  * SUCH DAMAGE.
  32  */
  33 
  34 /* character-name table */
  35 static struct cname {
  36         char *name;
  37         char code;
  38 } cnames[] = {
  39         {"NUL",                 '\0'},
  40         {"SOH",                 '\001'},
  41         {"STX",                 '\002'},
  42         {"ETX",                 '\003'},
  43         {"EOT",                 '\004'},
  44         {"ENQ",                 '\005'},
  45         {"ACK",                 '\006'},
  46         {"BEL",                 '\007'},
  47         {"alert",               '\007'},
  48         {"BS",                  '\010'},
  49         {"backspace",           '\b'},
  50         {"HT",                  '\011'},
  51         {"tab",                 '\t'},
  52         {"LF",                  '\012'},
  53         {"newline",             '\n'},
  54         {"VT",                  '\013'},
  55         {"vertical-tab",        '\v'},
  56         {"FF",                  '\014'},
  57         {"form-feed",           '\f'},
  58         {"CR",                  '\015'},
  59         {"carriage-return",     '\r'},
  60         {"SO",                  '\016'},
  61         {"SI",                  '\017'},
  62         {"DLE",                 '\020'},
  63         {"DC1",                 '\021'},
  64         {"DC2",                 '\022'},
  65         {"DC3",                 '\023'},
  66         {"DC4",                 '\024'},
  67         {"NAK",                 '\025'},
  68         {"SYN",                 '\026'},
  69         {"ETB",                 '\027'},
  70         {"CAN",                 '\030'},
  71         {"EM",                  '\031'},
  72         {"SUB",                 '\032'},
  73         {"ESC",                 '\033'},
  74         {"IS4",                 '\034'},
  75         {"FS",                  '\034'},
  76         {"IS3",                 '\035'},
  77         {"GS",                  '\035'},
  78         {"IS2",                 '\036'},
  79         {"RS",                  '\036'},
  80         {"IS1",                 '\037'},
  81         {"US",                  '\037'},
  82         {"space",               ' '},
  83         {"exclamation-mark",    '!'},
  84         {"quotation-mark",      '"'},
  85         {"number-sign",         '#'},
  86         {"dollar-sign",         '$'},
  87         {"percent-sign",        '%'},
  88         {"ampersand",           '&'},
  89         {"apostrophe",          '\''},
  90         {"left-parenthesis",    '('},
  91         {"right-parenthesis",   ')'},
  92         {"asterisk",            '*'},
  93         {"plus-sign",           '+'},
  94         {"comma",               ','},
  95         {"hyphen",              '-'},
  96         {"hyphen-minus",        '-'},
  97         {"period",              '.'},
  98         {"full-stop",           '.'},
  99         {"slash",               '/'},
 100         {"solidus",             '/'},
 101         {"zero",                '0'},
 102         {"one",                 '1'},
 103         {"two",                 '2'},
 104         {"three",               '3'},
 105         {"four",                '4'},
 106         {"five",                '5'},
 107         {"six",                 '6'},
 108         {"seven",               '7'},
 109         {"eight",               '8'},
 110         {"nine",                '9'},
 111         {"colon",               ':'},
 112         {"semicolon",           ';'},
 113         {"less-than-sign",      '<'},
 114         {"equals-sign",         '='},
 115         {"greater-than-sign",   '>'},
 116         {"question-mark",       '?'},
 117         {"commercial-at",       '@'},
 118         {"left-square-bracket", '['},
 119         {"backslash",           '\\'},
 120         {"reverse-solidus",     '\\'},
 121         {"right-square-bracket", ']'},
 122         {"circumflex",          '^'},
 123         {"circumflex-accent",   '^'},
 124         {"underscore",          '_'},
 125         {"low-line",            '_'},
 126         {"grave-accent",        '`'},
 127         {"left-brace",          '{'},
 128         {"left-curly-bracket",  '{'},
 129         {"vertical-line",       '|'},
 130         {"right-brace",         '}'},
 131         {"right-curly-bracket", '}'},
 132         {"tilde",               '~'},
 133         {"DEL", '\177'},
 134         {NULL,  0}
 135 };