ascii-3.15/ascii.1 0000664 0001750 0001750 00000015173 12245477425 012075 0 ustar esr esr '\" t
.\" Title: ascii
.\" Author: [see the "AUTHOR" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1
.\" Date: 11/27/2013
.\" Manual: Development Tools
.\" Source: ascii
.\" Language: English
.\"
.TH "ASCII" "1" "11/27/2013" "ascii" "Development Tools"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
ascii \- report character aliases
.SH "SYNOPSIS"
.HP \w'\fBascii\fR\ 'u
\fBascii\fR [\-dxohv] [\-t] [\fIchar\-alias\fR...]
.SH "OPTIONS"
.PP
Called with no options,
\fBascii\fR
behaves like `ascii \-h\*(Aq\&. Options are as follows:
.PP
\-t
.RS 4
Script\-friendly mode, emits only ISO/decimal/hex/octal/binary encodings of the character\&.
.RE
.PP
\-s
.RS 4
Parse multiple characters\&. Convenient way of parsing strings\&.
.RE
.PP
\-d
.RS 4
Ascii table in decimal\&.
.RE
.PP
\-x
.RS 4
Ascii table in hex\&.
.RE
.PP
\-o
.RS 4
Ascii table in octal\&.
.RE
.PP
\-h, \-?
.RS 4
Show summary of options and a simple ASCII table\&.
.RE
.PP
\-v
.RS 4
Show version of program\&.
.RE
.SH "DESCRIPTION"
.PP
Characters in the ASCII set can have many aliases, depending on context\&. A character\*(Aqs possible names include:
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Its bit pattern (binary representation)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Its hex, decimal and octal representations\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Its teletype mnemonic and caret\-notation form (for control chars)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Its backlash\-escape form in C (for some control chars)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Its printed form (for printables)\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Its full ISO official name in English\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Its ISO/ECMA code table reference\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Its name as an HTML/SGML entity\&.
.RE
.sp
.RS 4
.ie n \{\
\h'-04'\(bu\h'+03'\c
.\}
.el \{\
.sp -1
.IP \(bu 2.3
.\}
Slang and other names in wide use for it among hackers\&.
.RE
.PP
This utility accepts command\-line strings and tries to interpret them as one of the above\&. When it finds a value, it prints
\fIall\fR
of the names of the character\&. The constructs in the following list can be used to specify character values\&. If an argument could be interpreted in two or more ways, names for all the different characters it might be are dumped\&.
.PP
\fIcharacter\fR
.RS 4
Any character not described by one of the following conventions represents the character itself\&.
.RE
.PP
\fB^\fR\fIcharacter\fR
.RS 4
A caret followed by a character\&.
.RE
.PP
\fB\e\fR\fI[abfnrtv0]\fR
.RS 4
A backslash followed by certain special characters (abfnrtv)\&.
.RE
.PP
\fImnemonic\fR
.RS 4
An ASCII teletype mnemonic\&.
.RE
.PP
\fIhexadecimal\fR
.RS 4
A hexadecimal (hex) sequence consists of one or two case\-insensitive hex digit characters (01234567890abcdef)\&. To ensure hex interpretation use
\fIhex\fR\fBh\fR\fI,\fR\fB0x\fR\fIhex,\fR\fBx\fR\fIhex\fR
or
\fB\ex\fR\fIhex\&.\fR
.RE
.PP
\fIdecimal\fR
.RS 4
A decimal sequence consists of one, two or three decimal digit characters (0123456789)\&. To ensure decimal interpretation use
\fB\e0d\fR\fIdecimal,\fR\fBd\fR\fIdecimal,\fR
or
\fB\ed\fR\fIdecimal\&.\fR
.RE
.PP
\fIoctal\fR
.RS 4
An octal sequence consists of one, two or three octal digit characters (01234567)\&. To ensure octal interpretation use
\fB\e\fR\fI,\fR\fB0o\fR\fI,\fR\fBo\fR\fI,\fR
or
\fB\eo\fR\fI\&.\fR
.RE
.PP
\fIbit pattern\fR
.RS 4
A bit pattern (binary) sequence consists of one to eight binary digit characters (01)\&. To ensure bit interpretation use
\fB0b\fR\fI,\fR\fBb\fR\fI\fR
or
\fB\eb\fR\fI\&.\fR
.RE
.PP
\fIISO\fR/\fIECMA code\fR
.RS 4
An ISO/ECMA code sequence consists of one or two decimal digit characters, a slash, and one or two decimal digit characters\&.
.RE
.PP
\fIname\fR
.RS 4
An official ASCII or (unofficial) slang name\&.
.RE
.PP
The slang names recognized and printed out are from a rather comprehensive list that first appeared on USENET in early 1990 and has been continuously updated since\&. Mnemonics recognized and printed include the official ASCII set, some official ISO names (where those differ) and a few common\-use alternatives (such as NL for LF)\&. HTML/SGML entity names are also printed when applicable\&. All comparisons are case\-insensitive, and dashes are mapped to spaces\&. Any unrecognized arguments or out of range values are silently ignored\&. Note that the
\fB\-s\fR
option will not recognize \*(Aqlong\*(Aq names, as it cannot differentiate them from other parts of the string\&.
.PP
For correct results, be careful to stringize or quote shell metacharacters in arguments (especially backslash)\&.
.PP
This utility is particularly handy for interpreting cc(1)\*(Aqs ugly octal `invalid\-character\*(Aq messages, or when coding anything to do with serial communications\&. As a side effect it serves as a handy base\-converter for random 8\-bit values\&.
.SH "AUTHOR"
.PP
Eric S\&. Raymond
; November 1990 (home page at
\m[blue]\fBhttp://www\&.catb\&.org/~esr/\fR\m[])\&. Reproduce, use, and modify as you like as long as you don\*(Aqt remove this authorship notice\&. Ioannis E\&. Tambouras added command options and minor enhancements\&. Brian J\&. Ginsbach fixed several bugs and expanded the man page\&. David N\&. Welton added the
\fB\-s\fR
option\&. Matej Vela corrected the ISO names\&. Dave Capella contributed the idea of listing HTML/SGML entities\&.
ascii-3.15/ascii.c 0000664 0001750 0001750 00000023541 12245477170 012152 0 ustar esr esr /*
* ascii.c -- quick crossreference for ASCII character aliases
*
* Tries to interpret arguments as names or aliases of ascii characters
* and dumps out *all* the aliases of each. Accepts literal characters,
* standard mnemonics, C-style backslash escapes, caret notation for control
* characters, numbers in hex/decimal/octal/binary, English names.
*
* The slang names used are selected from the 2.2 version of the USENET ascii
* pronunciation guide. Some additional ones were merged in from the Jargon
* File.
*
* For license terms, see the file COPYING.
*/
#ifndef S_SPLINT_S
#include
#include
#endif /* S_SPLINT_S */
#include
#include
#include
#include
#include
#ifdef __CYGWIN__
#undef stricmp
#endif /* __CYGWIN__ */
typedef char *string;
static bool terse = false;
static bool help = false;
static bool line = false;
enum { decimal, hex, octal } mode;
void print_table(unsigned short delivery);
static string cnames[128][16] =
{
{
#include "nametable.h"
}
};
static int atob(str)
/* ASCII-to-binary conversion */
char *str;
{
int val;
for (val = 0; *str != '\0'; str++)
{
val *= 2;
if (*str == '1')
val++;
else if (*str != '0')
return(-1);
}
return(val);
}
void
showHelp(FILE *out, char *progname)
{
fprintf(out,"Usage: %s [-dxohv] [-t] [char-alias...]\n", progname);
#define P(s) (void)fputs(s "\n", out);
#include "splashscreen.h"
#undef P
exit(0);
}
static void process_options(int argc, char *argv[], char * opt_string)
{
int op;
while( (op=getopt(argc, argv, opt_string)) != -1) {
switch (op) {
case 't':
terse = true;
break;
case 's':
terse = true;
line = true;
break;
case 'd':
print_table(decimal);
exit(0);
case 'x':
print_table(hex);
exit(0);
case 'o':
print_table(octal);
exit(0);
case '?':
case 'h':
help = true;
break;
case 'v':
printf("ascii %3.2f\n",REVISION);
exit(0);
default :
help = true;
break;
} /*switch*/
}/*while*/
}
static char *btoa(unsigned int val)
/* binary-to-ASCII conversion */
{
#define BITSPERCHAR 8
char *rp;
static char rep[BITSPERCHAR + 1];
/* write out external representation at least one char */
*(rp = rep + BITSPERCHAR) = '\0';
do {
*--rp = (char)('0' + (val & 1)); /* Is '1' == '0' + 1 in EBCDIC? */
val /= 2;
} while
(val != 0 && rp > rep);
#ifndef SHORT_BINARY_REPRESENTATION
while (rp > rep)
*--rp = '0';
#endif
return(rp);
}
static void speak(unsigned int ch)
/* list all the names for a given character */
{
char **ptr = &cnames[ch][0];
if (terse) {
(void) printf("%u/%u %u 0x%02X 0o%o %s\n",
ch / 16, ch % 16, ch, ch, ch, btoa(ch));
return;
}
(void) printf(
"ASCII %u/%u is decimal %03u, hex %02x, octal %03o, bits %s: ",
ch / 16, ch % 16, ch, ch, ch, btoa(ch));
/* display high-half characters */
if (ch & 0x80)
{
ch &=~ 0x80;
if (ch == 0x7f)
(void) printf("meta-^?\n");
else if (isprint((int)ch))
(void) printf("meta-%c\n", (char)ch);
else
(void) printf("meta-^%c\n", '@' + (ch & 0x1f));
return;
}
if (isprint((int)ch))
(void) printf("prints as `%s'\n", *ptr++);
else if (iscntrl((char)ch) || ch == 0x7F)
{
if (ch == 0x7f)
(void) printf("called ^?");
else
(void) printf("called ^%c", '@' + (ch & 0x1f));
for (; strlen(*ptr) < 4 && isupper(**ptr); ptr++)
(void) printf(", %s", *ptr);
(void) putchar('\n');
}
(void) printf("Official name: %s\n", *ptr++);
if (*ptr)
{
char *commentary = (char *)NULL;
if (**ptr == '\\')
{
(void) printf("C escape: '%s'\n", *ptr);
ptr++;
}
(void) printf("Other names: ");
for (; *ptr; ptr++)
if (**ptr == '#')
commentary = *ptr;
else
(void) printf("%s%s ", *ptr,
(ptr[1]!=NULL && *ptr[1] != '#') ? "," : "");
(void) putchar('\n');
if (commentary)
(void) printf("Note: %s\n", commentary+2);
}
(void) putchar('\n');
}
static int stricmp(char *s, char *t)
/* case-blind string compare */
{
while (*s!='\0' && tolower(*s) == tolower(*t))
s++, t++;
return (int)(*t - *s);
}
static void ascii(char *str)
{
int ch, hi, lo;
char **ptr;
size_t len = strlen(str);
/* interpret single characters as themselves */
if (len == 1) {
speak((unsigned int)str[0]);
/* also interpret single digits as numeric */
if(!line && strchr("0123456789ABCDEFabcdef",str[0])) {
int hval;
(void) sscanf(str, "%x", &hval);
speak(hval);
} return;
}
/* process multiple letters */
if (line == 1) {
for (ch = 0; ch < len; ch ++) {
speak((unsigned int)str[ch]);
}
return;
}
/* interpret ^-escapes as control-character notation */
if (strcmp(str, "^?") == 0)
{ speak((unsigned int)0x7F); return; }
else if (str[0] == '^' && len == 2)
{ speak((unsigned int)(str[1] & 0x1f)); return; }
/* interpret C-style backslash escapes */
if (*str == '\\' && len == 2 && strchr("abfnrtv0", str[1]))
for (ch = 7; ch < 14; ch++)
for (ptr = &cnames[ch][1]; *ptr; ptr++)
if (**ptr == '\\' && strcmp(str, *ptr) == 0)
{ speak((unsigned int)ch); return; }
/* interpret 2 and 3-character ASCII control mnemonics */
if (len == 2 || len == 3)
{
/* first check for standard mnemonics */
if (stricmp(str, "DEL") == 0)
{ speak(0x7f); return; }
if (stricmp(str, "BL") == 0)
{ speak(' '); return; }
else if (isalpha(str[0]))
for (ch = 0; ch <= 32; ch++)
if (!stricmp(str,cnames[ch][0]) || !strcmp(str,cnames[ch][1]))
{ speak(ch); return; }
}
/* OK, now try to interpret the string as a numeric */
if (len > 1 && len < 9)
{
int hval, dval, oval, bval, spoken = 0;
dval = oval = hval = bval = -1;
/* if it's all numeric it could be in one of three bases */
if (len <= 2 && strspn(str,"0123456789ABCDEFabcdef") == len)
(void) sscanf(str, "%x", &hval);
if (len <= 3 && strspn(str, "0123456789") == len)
(void) sscanf(str, "%d", &dval);
if (len <= 3 && strspn(str, "01234567") == len)
(void) sscanf(str, "%o", &oval);
if (len <= 9 && strspn(str, "01") == len)
bval = atob(str);
/* accept 0xnn, \xnn, xnn and nnh forms for hex */
if (hval == -1)
if ((str[0]=='0'||str[0]=='\\') && tolower(str[1]) == 'x')
(void) sscanf(str + 2, "%x", &hval);
else if (tolower(str[0]) == 'x')
(void) sscanf(str + 1, "%x", &hval);
else if ((len >= 2) && (len <= 3) &&
(strspn(str,"0123456789ABCDEFabcdef") == (len-1)) &&
(tolower(str[len - 1]) == 'h'))
(void) sscanf(str, "%x", &hval);
/* accept 0onn, \onnn, onnn and \nnn forms for octal */
if (oval == -1)
if ((str[0]=='0'||str[0]=='\\') && tolower(str[1]) == 'o')
(void) sscanf(str + 2, "%o", &oval);
else if (tolower(str[0]) == 'o')
(void) sscanf(str + 1, "%o", &oval);
else if (str[0] == '\\' && strspn(str + 1, "0123456789") == len - 1)
(void) sscanf(str + 1, "%o", &oval);
/* accept 0dnnn, \dnnn and dnnn forms for decimal */
if (dval == -1)
if ((str[0]=='0'||str[0]=='\\') && tolower(str[1]) == 'd')
(void) sscanf(str + 2, "%d", &dval);
else if (tolower(str[0]) == 'd')
(void) sscanf(str + 1, "%d", &dval);
/* accept 0bnnn, \bnnn and bnnn forms for binary */
if (bval == -1)
if ((str[0]=='0'||str[0]=='\\') && tolower(str[1]) == 'b')
bval = atob(str + 2);
else if (tolower(str[0]) == 'b')
bval = atob(str + 1);
/* OK, now output all values */
if (hval > -1 && hval < 256)
speak(hval & 0xff);
if (dval > -1 && dval < 256)
speak(dval & 0xff);
if (oval > -1 && oval < 256)
speak(oval & 0xff);
if (bval > -1 && bval < 256)
speak(bval & 0xff);
if (!(hval==-1 && dval==-1 && oval==-1 && bval==-1))
{
if (hval > -1 || dval > -1 || oval > -1 || bval > -1)
return;
if (hval < 256 || dval < 256 || oval < 256 || bval < 256)
return;
}
}
if (sscanf(str, "%d/%d", &hi, &lo) == 2) /* code table reference? */
{ speak(hi*16 + lo); return; }
else if (len > 1 && isalpha(str[0])) /* try to match long names */
{
char canbuf[BUFSIZ], *ep;
int i;
/* map dashes and other junk to spaces */
for (i = 0; i <= len; i++)
if (str[i] == '-' || isspace(str[i]))
canbuf[i] = ' ';
else
canbuf[i] = str[i];
/* strip `sign' or `Sign' suffix */
ep = canbuf + strlen(canbuf) - 4;
if (!strcmp(ep, "sign") || !strcmp(ep, "Sign"))
*ep = '\0';
/* remove any trailing whitespace */
while (canbuf[strlen(canbuf) - 1] == ' ')
canbuf[strlen(canbuf) - 1] = '\0';
/* look through all long names for a match */
for (ch = 0; ch < 128; ch++)
for (ptr = &cnames[ch][1]; *ptr; ptr++)
if (!stricmp(*ptr, canbuf))
speak(ch);
} /* outer if */
}
void print_table(unsigned short delivery)
{
static unsigned short i, j, len;
char separator[]= " ";
char *tail = separator + 3 ;
char *space;
char *name ;
for (i=0;i<16; i++) {
for (j=0; j<8; j++) {
name= *cnames[i+(j*16)];
len = strlen(name);
space = tail - (len % 3) ;
switch (delivery) {
case decimal: printf("%5d %1s%1s",i+(j*16),name,space);
break;
case octal : printf("%5o %1s%1s",i+(j*16),name,space);
break;
case hex : printf("%5X %1s%1s",i+(j*16),name,space);
break;
}
}
printf("\n");
}
}
int main(int argc, char **argv)
{
char *optstring="tshvxod" ;
process_options(argc, argv, optstring) ;
if (help || argc == optind)
showHelp(stdout, argv[0]);
else
while (optind < argc)
ascii(argv[optind++]);
exit(0);
}
/* ascii.c ends here */
ascii-3.15/ascii.xml 0000644 0001750 0001750 00000020000 12245477375 012520 0 ustar esr esr
ascii1Aug 24 1994asciiasciiDevelopment Toolsasciireport character aliasesascii-dxohv -t char-aliasOPTIONSCalled with no options, ascii behaves like
`ascii -h'. Options are as follows:-tScript-friendly mode, emits only ISO/decimal/hex/octal/binary
encodings of the character.-sParse multiple characters. Convenient way of parsing strings.-dAscii table in decimal.-xAscii table in hex.-oAscii table in octal.-h, -?Show summary of options and a simple ASCII table.-vShow version of program.DESCRIPTIONCharacters in the ASCII set can have many aliases, depending on
context. A character's possible names include:Its bit pattern (binary representation).Its hex, decimal and octal representations.Its teletype mnemonic and caret-notation form (for control chars).Its backlash-escape form in C (for some control chars).Its printed form (for printables).Its full ISO official name in English.Its ISO/ECMA code table reference.Its name as an HTML/SGML entity.Slang and other names in wide use for it among hackers.This utility accepts command-line strings and tries to interpret them as
one of the above.
When it finds a value, it prints all of the names
of the character.
The constructs in the following list can be used to
specify character values.
If an argument could be interpreted in two or more
ways, names for all the different characters it might be are dumped.characterAny character not described by one of the following conventions
represents the character itself.^characterA caret followed by a character.\[abfnrtv0]A backslash followed by certain special characters (abfnrtv).mnemonicAn ASCII teletype mnemonic.hexadecimalA hexadecimal (hex) sequence consists of one or two case-insensitive hex digit
characters (01234567890abcdef).
To ensure hex interpretation use
hexh,0xhex,xhex
or
\xhex.decimalA decimal sequence consists of one, two or three decimal digit
characters (0123456789).
To ensure decimal interpretation use
\0ddecimal,ddecimal,
or
\ddecimal.octalAn octal sequence consists of one, two or three octal digit
characters (01234567).
To ensure octal interpretation use
\<octal>,0o<octal>,o<octal>,
or
\o<octal>.bit patternA bit pattern (binary) sequence consists of one to eight binary digit
characters (01).
To ensure bit interpretation use
0b<bit pattern>,b<bit pattern>
or
\b<bit pattern>.ISO/ECMA codeAn ISO/ECMA code sequence consists of one or two decimal digit characters,
a slash, and one or two decimal digit characters.nameAn official ASCII or (unofficial) slang name.The slang names recognized and printed out are from a rather
comprehensive list that first appeared on USENET in early 1990 and has
been continuously updated since. Mnemonics recognized and printed
include the official ASCII set, some official ISO names (where those
differ) and a few common-use alternatives (such as NL for LF).
HTML/SGML entity names are also printed when applicable. All
comparisons are case-insensitive, and dashes are mapped to spaces.
Any unrecognized arguments or out of range values are silently
ignored. Note that the option will not recognize
'long' names, as it cannot differentiate them from other parts of the
string.For correct results, be careful to stringize or quote shell
metacharacters in arguments (especially backslash).This utility is particularly handy for interpreting cc(1)'s ugly
octal `invalid-character' messages, or when coding anything to do with
serial communications. As a side effect it serves as a handy
base-converter for random 8-bit values.AUTHOREric S. Raymond esr@thyrsus.com; November
1990 (home page at http://www.catb.org/~esr/).
Reproduce, use, and modify as you like as long as you don't remove
this authorship notice. Ioannis E. Tambouras
<ioannis@debian.org> added command options and minor
enhancements. Brian J. Ginsbach <ginsbach@sgi.com> fixed
several bugs and expanded the man page. David N. Welton
<davidw@efn.org> added the option. Matej
Vela corrected the ISO names. Dave Capella contributed the idea of
listing HTML/SGML entities.
ascii-3.15/control 0000664 0001750 0001750 00000001621 12507227056 012311 0 ustar esr esr # This is not a real Debian control file, though the syntax is compatible.
# It's project metadata for the shipper tool
Package: ascii
Description: List ASCII idiomatic names and octal/decimal code-point forms.
Provides easy conversion between various byte representations and the
American Standard Code for Information Interchange (ASCII) character
table. It knows about a wide variety of hex, binary, octal, Teletype
mnemonic, ISO/ECMA code point, slang names, XML entity names, and
other representations. Given any one on the command line, it will try
to display all others. Called with no arguments it displays a handy
small ASCII chart.
XBS-Repository-URL: http://thyrsus.com/gitweb/?p=ascii.git
XBS-Clone-From: git@thyrsus.com:ascii
XBS-Destinations: freecode
Homepage: http://www.catb.org/~esr/ascii
XBS-HTML-Target: index.html
XBS-Freecode-Tags: ASCII
XBS-VC-Tag-Template: %(version)s
ascii-3.15/COPYING 0000644 0001750 0001750 00000002615 11457220655 011744 0 ustar esr esr BSD LICENSE
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
Neither name of the this project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ascii-3.15/Makefile 0000644 0001750 0001750 00000002711 12507235402 012337 0 ustar esr esr # ascii -- interactive ASCII reference
VERS=3.15
CFLAGS = -O
PREFIX = /usr
all: ascii ascii.1
ascii: ascii.c splashscreen.h nametable.h
$(CC) $(CFLAGS) -DREVISION=$(VERS) ascii.c -o ascii
splashscreen.h: splashscreen
sed splashscreen.h -e 's/\\/\\\\/g' -e 's/"/\\"/g' -e 's/.*/P("&");/'
nametable.h: nametable
sed nametable.h -e '/^#/d' -e 's/^[A-Za-z ]*: */ /' -e 's/%%/ }, {/'
ascii.1: ascii.xml
xmlto man ascii.xml
ascii.html: ascii.xml
xmlto html-nochunks ascii.xml
clean:
rm -f ascii ascii.o splashscreen.h nametable.h *.rpm *.tar.gz MANIFEST *.1 *.html
CPPCHECKOPTS =
cppcheck: nametable.h splashscreen.h
cppcheck -DREVISION=$(VERS) $(CPPCHECKOPTS) ascii.c
SPLINT_SUPPRESSIONS = -boolops -nullret -initallelements +charintliteral
splint:
splint +quiet +posixlib $(SPLINT_SUPPRESSIONS) ascii.c
install: ascii ascii.1
cp ascii $(DESTDIR)$(PREFIX)/bin/ascii
cp ascii.1 $(DESTDIR)$(PREFIX)/share/man/man1
uninstall:
rm $(DESTDIR)$(PREFIX)/bin/ascii
rm $(DESTDIR)$(PREFIX)/share/man/man1/ascii.1
SOURCES = README COPYING control Makefile ascii.c ascii.xml splashscreen nametable
ascii-$(VERS).tar.gz: $(SOURCES) ascii.1
@ls $(SOURCES) ascii.1 | sed s:^:ascii-$(VERS)/: >MANIFEST
@(cd ..; ln -s ascii ascii-$(VERS))
(cd ..; tar -czvf ascii/ascii-$(VERS).tar.gz `cat ascii/MANIFEST`)
@(cd ..; rm ascii-$(VERS))
dist: ascii-$(VERS).tar.gz
release: ascii-$(VERS).tar.gz ascii.html
shipper version=$(VERS) | sh -e -x
ascii-3.15/nametable 0000644 0001750 0001750 00000025014 12245501067 012555 0 ustar esr esr # Master name table for the ASCII utility.
# The colon-terminated field names are not interpreted, they're for human eyes.
# Most of this file gets copied into one big C initializer.
Mnemonics: "NUL",
ISO names: "Null",
C escape: "\\0",
%%
Mnemonics: "SOH",
ISO names: "Start Of Header",
%%
Mnemonics: "STX",
ISO names: "Start of Text",
%%
Mnemonics: "ETX",
ISO names: "End of Text",
%%
Mnemonics: "EOT",
ISO names: "End Of Transmission",
%%
Mnemonics: "ENQ",
ISO names: "Enquiry",
%%
Mnemonics: "ACK",
ISO names: "Acknowledge",
%%
Mnemonics: "BEL",
ISO names: "Bell",
C escape: "\\a",
Synonyms: "Alert",
%%
Mnemonics: "BS",
ISO names: "Backspace",
C escape: "\\b",
%%
Mnemonics: "HT", "TAB",
ISO names: "Character Tabulation", "Horizontal Tab",
C escape: "\\t",
%%
Mnemonics: "LF", "NL",
ISO name: "Line Feed", "Newline",
C escape: "\\n",
%%
Mnemonics: "VT",
ISO names: "Line Tabulation", "Vertical Tab",
C escape: "\\v",
%%
Mnemonics: "FF",
ISO names: "Form Feed",
C escape: "\\f",
%%
Mnemonics: "CR",
ISO names: "Carriage Return",
C escape: "\\r",
%%
Mnemonics: "SO", "LS1",
ISO names: "Shift Out", "Locking Shift 1",
%%
Mnemonics: "SI", "LS0",
ISO names: "Shift In", "Locking Shift 0",
%%
Mnemonics: "DLE",
ISO names: "Data Link Escape",
%%
Mnemonics: "DC1",
ISO names: "Device Control 1",
%%
Mnemonics: "DC2",
ISO names: "Device Control 2",
%%
Mnemonics: "DC3",
ISO names: "Device Control 3",
%%
Mnemonics: "DC4",
ISO names: "Device Control 4",
%%
Mnemonics: "NAK",
ISO names: "Negative Acknowledge",
%%
Mnemonics: "SYN",
ISO names: "Synchronous Idle",
%%
Mnemonics: "ETB",
ISO names: "End of Transmission Block",
%%
Mnemonics: "CAN",
ISO names: "Cancel",
%%
Mnemonics: "EM",
ISO names: "End of Medium",
%%
Mnemonics: "SUB",
ISO names: "Substitute",
%%
Mnemonics: "ESC",
ISO names: "Escape",
%%
Mnemonics: "FS",
ISO names: "File Separator",
%%
Mnemonics: "GS",
ISO names: "Group Separator",
%%
Mnemonics: "RS",
ISO names: "Record Separator",
%%
Mnemonics: "US",
ISO names: "Unit Separator",
%%
Mnemonics: " ", "SP",
ISO names: "Space", "Blank",
%%
Mnemonics: "!",
ISO names: "Exclamation Mark",
Synonyms: "Bang", "Excl", "Wow", "Factorial", "Shriek", "Pling", "Smash",
"Cuss",
%%
Mnemonics: "\"",
ISO names: "Quotation Mark",
Synonyms: "Double Quote", "Quote", "String Quote",
"Dirk", "Literal Mark", "Double Glitch",
XML name: """,
Comment: "# See ' and ` for matching names.",
%%
Mnemonics: "#",
ISO names: "Number Sign",
Synonyms: "Pound", "Number", "Sharp", "Crunch", "Mesh",
"Hex", "Hash", "Flash", "Grid", "Octothorpe",
%%
Mnemonics: "$",
ISO names: "Currency Sign",
Synonyms: "Dollar", "Buck", "Cash", "Ding",
%%
Mnemonics: "%",
ISO names: "Percent Sign",
Synonyms: "Mod", "Modulo",
%%
Mnemonics: "&",
ISO names: "Ampersand",
Synonyms: "Amper", "And",
XML name: "&",
%%
Mnemonics: "'",
ISO names: "Apostrophe",
Synonyms: "Single Quote", "Close Quote", "Prime",
"Tick", "Pop", "Spark", "Glitch",
XML name: "'",
Comment: "# See ` and \" for matching names.",
%%
Mnemonics: "(",
ISO names: "Left Parenthesis",
Synonyms: "Open", "Open Paren", "Left Paren", "Wax", "Sad",
Comment: "# See ) for matching names.",
%%
Mnemonics: ")",
ISO names: "Right Parenthesis",
Synonyms: "Close", "Close Paren", "Right Paren", "Wane", "Happy",
Comment: "# See ( for matching names.",
%%
Mnemonics: "*",
ISO names: "Asterisk",
Synonyms: "Star", "Splat", "Aster", "Times", "Gear",
"Dingle", "Bug", "Twinkle", "Glob" ,
%%
Mnemonics: "+",
ISO names: "Plus Sign",
Synonyms: "Add", "Cross",
%%
Mnemonics: ",",
ISO names: "Comma",
Synonyms: "Tail",
%%
Mnemonics: "-",
ISO names: "Hyphen",
Synonyms: "Dash", "Minus", "Worm",
%%
Mnemonics: ".",
ISO names: "Full Stop",
Synonyms: "Dot", "Decimal Point", "Radix Point", "Point", "Period", "Spot",
%%
Mnemonics: "/",
ISO names: "Solidus",
Synonyms: "Slash", "Stroke", "Slant", "Diagonal", "Virgule", "Over", "Slat",
Comment: "# See \\ for matching names.",
%%
Mnemonics: "0",
ISO names: "Digit Zero",
%%
Mnemonics: "1",
ISO names: "Digit One",
%%
Mnemonics: "2",
ISO names: "Digit Two",
%%
Mnemonics: "3",
ISO names: "Digit Three",
%%
Mnemonics: "4",
ISO names: "Digit Four",
%%
Mnemonics: "5",
ISO names: "Digit Five",
%%
Mnemonics: "6",
ISO names: "Digit Six",
%%
Mnemonics: "7",
ISO names: "Digit Seven",
%%
Mnemonics: "8",
ISO names: "Digit Eight",
%%
Mnemonics: "9",
ISO names: "Digit Nine",
%%
Mnemonics: ":",
ISO names: "Colon",
Synonyms: "Double-Dot",
%%
Mnemonics: ";",
ISO names: "Semicolon",
Synonyms: "Semi", "Go-on",
%%
Mnemonics: "<",
ISO names: "Less-than Sign",
Synonyms: "Left Angle Bracket", "Read From", "In",
"From", "Comesfrom", "Left Funnel", "Left Broket", "Crunch",
"Suck",
XML name: "<",
Comment: "# See > for matching names.",
%%
Mnemonics: "=",
ISO names: "Equals Sign",
Synonyms: "Quadrathorp", "Gets", "Becomes", "Half-Mesh",
%%
Mnemonics: ">",
ISO names: "Greater-than sign",
Synonyms: "Right Angle Bracket", "Write To", "Into", "Toward",
"Out", "To", "Gozinta", "Right Funnel",
"Right Broket", "Zap", "Blow",
XML name: ">",
Comments: "# See < for matching names.",
%%
Mnemonics: "?",
ISO names: "Question Mark",
Comments: "Whatmark", "What", "Ques",
%%
Mnemonics: "@",
ISO names: "Commercial At",
Synonyms: "At", "Each", "Vortex", "Whorl", "Whirlpool",
"Cyclone", "Snail", "Rose",
%%
Mnemonics: "A",
ISO names: "Majuscule A", "Capital A", "Uppercase A",
%%
Mnemonics: "B",
ISO names: "Majuscule B", "Capital B", "Uppercase B",
%%
Mnemonics: "C",
ISO names: "Majuscule C", "Capital C", "Uppercase C",
%%
Mnemonics: "D",
ISO names: "Majuscule D", "Capital D", "Uppercase D",
%%
Mnemonics: "E",
ISO names: "Majuscule E", "Capital E", "Uppercase E",
%%
Mnemonics: "F",
ISO names: "Majuscule F", "Capital F", "Uppercase F",
%%
Mnemonics: "G",
ISO names: "Majuscule G", "Capital G", "Uppercase G",
%%
Mnemonics: "H",
ISO names: "Majuscule H", "Capital H", "Uppercase H",
%%
Mnemonics: "I",
ISO names: "Majuscule I", "Capital I", "Uppercase I",
%%
Mnemonics: "J",
ISO names: "Majuscule J", "Capital J", "Uppercase J",
%%
Mnemonics: "K",
ISO names: "Majuscule K", "Capital K", "Uppercase K",
%%
Mnemonics: "L",
ISO names: "Majuscule L", "Capital L", "Uppercase L",
%%
Mnemonics: "M",
ISO names: "Majuscule M", "Capital M", "Uppercase M",
%%
Mnemonics: "N",
ISO names: "Majuscule N", "Capital N", "Uppercase N",
%%
Mnemonics: "O",
ISO names: "Majuscule O", "Capital O", "Uppercase O",
%%
Mnemonics: "P",
ISO names: "Majuscule P", "Capital P", "Uppercase P",
%%
Mnemonics: "Q",
ISO names: "Majuscule Q", "Capital Q", "Uppercase Q",
%%
Mnemonics: "R",
ISO names: "Majuscule R", "Capital R", "Uppercase R",
%%
Mnemonics: "S",
ISO names: "Majuscule S", "Capital S", "Uppercase S",
%%
Mnemonics: "T",
ISO names: "Majuscule T", "Capital T", "Uppercase T",
%%
Mnemonics: "U",
ISO names: "Majuscule U", "Capital U", "Uppercase U",
%%
Mnemonics: "V",
ISO names: "Majuscule V", "Capital V", "Uppercase V",
%%
Mnemonics: "W",
ISO names: "Majuscule W", "Capital W", "Uppercase W",
%%
Mnemonics: "X",
ISO names: "Majuscule X", "Capital X", "Uppercase X",
%%
Mnemonics: "Y",
ISO names: "Majuscule Y", "Capital Y", "Uppercase Y",
%%
Mnemonics: "Z",
ISO names: "Majuscule Z", "Capital Z", "Uppercase Z",
%%
Mnemonics: "[",
ISO names: "Left Square Bracket",
Synonyms: "Bracket", "Bra", "Square",
Comments: "# See ] for matching names.",
%%
Mnemonics: "\\",
ISO names: "Reversed Solidus",
Synonyms: "Backslash", "Bash", "Backslant", "Backwhack",
"Backslat", "Literal", "Escape",
Comments: "# See / for matching names.",
%%
Mnemonics: "]",
ISO names: "Right Square Bracket",
Synonyms: "Unbracket", "Ket", "Unsquare",
Comments: "# See [ for matching names.",
%%
Mnemonics: "^",
ISO names: "Circumflex Accent",
Synonyms: "Circumflex", "Caret", "Uparrow", "Hat",
"Control", "Boink", "Chevron", "Hiccup", "Sharkfin", "Fang",
%%
Mnemonics: "_",
ISO names: "Low Line",
Synonyms: "Underscore", "Underline", "Underbar",
"Under", "Score", "Backarrow", "Flatworm",
Comments: "# Backarrow refers to this character's graphic in 1963 ASCII.",
%%
Mnemonics: "`",
ISO names: "Grave Accent",
Synonyms: "Grave", "Backquote", "Left Quote",
"Open Quote", "Backprime", "Unapostrophe",
"Backspark", "Birk", "Blugle", "Back Tick", "Push",
Comments: "# See ' and \" for matching names.",
%%
Mnemonics: "a",
ISO names: "Miniscule a", "Small a", "Lowercase a",
%%
Mnemonics: "b",
ISO names: "Miniscule b", "Small b", "Lowercase b",
%%
Mnemonics: "c",
ISO names: "Miniscule c", "Small c", "Lowercase c",
%%
Mnemonics: "d",
ISO names: "Miniscule d", "Small d", "Lowercase d",
%%
Mnemonics: "e",
ISO names: "Miniscule e", "Small e", "Lowercase e",
%%
Mnemonics: "f",
ISO names: "Miniscule f", "Small f", "Lowercase f",
%%
Mnemonics: "g",
ISO names: "Miniscule g", "Small g", "Lowercase g",
%%
Mnemonics: "h",
ISO names: "Miniscule h", "Small h", "Lowercase h",
%%
Mnemonics: "i",
ISO names: "Miniscule i", "Small i", "Lowercase i",
%%
Mnemonics: "j",
ISO names: "Miniscule j", "Small j", "Lowercase j",
%%
Mnemonics: "k",
ISO names: "Miniscule k", "Small k", "Lowercase k",
%%
Mnemonics: "l",
ISO names: "Miniscule l", "Small l", "Lowercase l",
%%
Mnemonics: "m",
ISO names: "Miniscule m", "Small m", "Lowercase m",
%%
Mnemonics: "n",
ISO names: "Miniscule n", "Small n", "Lowercase n",
%%
Mnemonics: "o",
ISO names: "Miniscule o", "Small o", "Lowercase o",
%%
Mnemonics: "p",
ISO names: "Miniscule p", "Small p", "Lowercase p",
%%
Mnemonics: "q",
ISO names: "Miniscule q", "Small q", "Lowercase q",
%%
Mnemonics: "r",
ISO names: "Miniscule r", "Small r", "Lowercase r",
%%
Mnemonics: "s",
ISO names: "Miniscule s", "Small s", "Lowercase s",
%%
Mnemonics: "t",
ISO names: "Miniscule t", "Small t", "Lowercase t",
%%
Mnemonics: "u",
ISO names: "Miniscule u", "Small u", "Lowercase u",
%%
Mnemonics: "v",
ISO names: "Miniscule v", "Small v", "Lowercase v",
%%
Mnemonics: "w",
ISO names: "Miniscule w", "Small w", "Lowercase w",
%%
Mnemonics: "x",
ISO names: "Miniscule x", "Small x", "Lowercase x",
%%
Mnemonics: "y",
ISO names: "Miniscule y", "Small y", "Lowercase y",
%%
Mnemonics: "z",
ISO names: "Miniscule z", "Small z", "Lowercase z",
%%
Mnemonics: "{",
ISO names: "Left Curly Bracket",
Synonyms: "Left Brace", "Brace", "Open Brace", "Curly", "Leftit", "Embrace",
Comments: "# See } for matching names.",
%%
Mnemonics: "|",
ISO names: "Vertical Line",
Synonyms: "Pipe", "Bar", "Or", "V-Bar", "Spike", "Gozinta", "Thru",
%%
Mnemonics: "}",
ISO names: "Right Curly Bracket",
Synonyms: "Right Brace", "Unbrace", "Close Brace",
"Uncurly", "Rytit", "Bracelet",
Comments: "# See { for matching names.",
%%
Mnemonics: "~",
ISO names: "Overline",
Synonyms: "Tilde", "Swung Dash", "Squiggle", "Approx",
"Wiggle", "Twiddle", "Enyay",
%%
Mnemonics: "DEL",
ISO names: "Delete",
ascii-3.15/README 0000644 0001750 0001750 00000000551 12245471772 011572 0 ustar esr esr ascii
This is a handy little utility that recognizes many different ways of
naming an ASCII character (hex, octal, binary, decimal, C escape, ISO
character table pair, slang names, and others) and prints out all the
equivalents.
The latest sources for this utility live at
http://www.catb.org/~esr/ascii/
Eric S. Raymond
esr@thyrsus.com
ascii-3.15/splashscreen 0000644 0001750 0001750 00000003111 10211364735 013311 0 ustar esr esr -t = one-line output -d = Decimal table -o = octal table -x = hex table
-h = This help screen -v = version information
Prints all aliases of an ASCII character. Args may be chars, C \-escapes,
English names, ^-escapes, ASCII mnemonics, or numerics in decimal/octal/hex.
Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex Dec Hex
0 00 NUL 16 10 DLE 32 20 48 30 0 64 40 @ 80 50 P 96 60 ` 112 70 p
1 01 SOH 17 11 DC1 33 21 ! 49 31 1 65 41 A 81 51 Q 97 61 a 113 71 q
2 02 STX 18 12 DC2 34 22 " 50 32 2 66 42 B 82 52 R 98 62 b 114 72 r
3 03 ETX 19 13 DC3 35 23 # 51 33 3 67 43 C 83 53 S 99 63 c 115 73 s
4 04 EOT 20 14 DC4 36 24 $ 52 34 4 68 44 D 84 54 T 100 64 d 116 74 t
5 05 ENQ 21 15 NAK 37 25 % 53 35 5 69 45 E 85 55 U 101 65 e 117 75 u
6 06 ACK 22 16 SYN 38 26 & 54 36 6 70 46 F 86 56 V 102 66 f 118 76 v
7 07 BEL 23 17 ETB 39 27 ' 55 37 7 71 47 G 87 57 W 103 67 g 119 77 w
8 08 BS 24 18 CAN 40 28 ( 56 38 8 72 48 H 88 58 X 104 68 h 120 78 x
9 09 HT 25 19 EM 41 29 ) 57 39 9 73 49 I 89 59 Y 105 69 i 121 79 y
10 0A LF 26 1A SUB 42 2A * 58 3A : 74 4A J 90 5A Z 106 6A j 122 7A z
11 0B VT 27 1B ESC 43 2B + 59 3B ; 75 4B K 91 5B [ 107 6B k 123 7B {
12 0C FF 28 1C FS 44 2C , 60 3C < 76 4C L 92 5C \ 108 6C l 124 7C |
13 0D CR 29 1D GS 45 2D - 61 3D = 77 4D M 93 5D ] 109 6D m 125 7D }
14 0E SO 30 1E RS 46 2E . 62 3E > 78 4E N 94 5E ^ 110 6E n 126 7E ~
15 0F SI 31 1F US 47 2F / 63 3F ? 79 4F O 95 5F _ 111 6F o 127 7F DEL