[comp.sources.misc] v08i018: achart.c - 80 * 22 line ASCII/hex/octal/control chart

allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc) (08/26/89)

Posting-number: Volume 8, Issue 18
Submitted-by: wwg@brambo.UUCP (Warren W. Gay)
Archive-name: achart

#--------------------------------CUT HERE-------------------------------------
#! /bin/sh
#
# This is a shell archive.  Save this into a file, edit it
# and delete all lines above this comment.  Then give this
# file to sh by executing the command "sh file".  The files
# will be extracted into the current directory owned by
# you with default permissions.
#
# The files contained herein are:
#
# -rw-r--r--   1 wwg      other       2961 Aug 25 15:05 achart.c
#
echo 'x - achart.c'
if test -f achart.c; then echo 'shar: not overwriting achart.c'; else
sed 's/^X//' << '________This_Is_The_END________' > achart.c
X/* ACHART.C -- WWG -- VE3WWG -- 25AUG89 -- Bramalea Software Systems 
X-------------------------------------------------------------------------------
X	This program's distribution status is * UNLIMITED *
X			see below for proof
X-------------------------------------------------------------------------------
X
X	Any copy of this program may be copied again, without constraint,
X	for all intents and purposes conceivable, or no purpose at all.
X
X	It may also be copied for inconceivable purposes, or not copied
X	at all.  It may even be typed in manually again freely with plenty 
X	of errors and perhaps only one or two.  It can be recreated again
X	from scratch, or using parts of this original file.
X
X	It may also be munged, mangled, pillaged, ripped, torn, shreaded,
X	pirated, shared, printed, sold, bought, traded, viewed, deleted,
X	added, merged, stomped on, moved, renamed, recorded, erased,
X	transported, stowed, scented, ignored, loved, hated, backed up,
X	overwritten, edited, studied, exposed, gift wrapped, used, collected,
X	displayed, spun, compressed, squashed, zooed, arced, tared,
X	streched, sheared, rotated, rivited, transmitted and/or received,
X	encrypted, converted, perverted, reverted, confiscated, used as
X	evidence, or passed on in a will (taxes might apply).
X
X	It may be sent/received in ASCII, morse code, baudot, Russian (or
X	any spoken language) and yes, even EBCDIC!
X
X	It may be stored on earth, or in space, your attic, your hard drive, 
X	your sloppy disk, your flippy disk, or in rural Russia. It may also
X	be kept in core memory, on paper or carbons, a coleco adam, vic-20,
X	commodore (if u must), on reel to reel, cassette, bubble memory, 
X	volatile memory, CD, magnetic drum, relays, vacuum tubes, WORM, ROM,
X	EEPROM, EPROM, PROM, Wong, and yes, even an IBM 370 main frame.
X
X	Wait! There's more!
X
X	Even surviving 4004, 8008, 8080, 6502, 6800, and Cosmac ELFs processors
X	need not fear any litigation.
X
X	Distribution and use is unlimited.
X-------------------------------------------------------------------------------	
X*/
X#include "stdio.h"
X#include "ctype.h"
X
Xint main(argc,argv)
Xint argc;
Xchar *argv[];
X	{
X	unsigned short u, v;
X	void show();
X
X	for ( u = 0; u < 22; ++u ) {
X		for ( v = 0; v < 6; ++v )
X			show(u + v * 22);
X		putchar('\n');
X		}
X	}
X
Xvoid show(u)
Xunsigned short u;
X	{
X	char chr[10];
X	static char *name[] = {
X		"nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs",
X		"ht", "lf", "vt", "ff", "cr", "so", "si", "dle", "dc1", "dc2",
X		"dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc",
X		"fs", "gs", "rs", "us" };
X
X	if ( u >= 128 )
X		return;
X	else if ( u < 040 )
X		sprintf(chr,"^%c %-3s", (unsigned int) u + '@', name[u] );
X	else if ( u == 040 )
X		strcpy(chr,"space ");
X	else if ( u == 127 )
X		strcpy(chr,"del   ");
X	else if ( u < 44 )
X		sprintf(chr,"%c   ",u);
X	else	{
X		chr[0] = u;
X		chr[1] = 0;
X		}
X	if ( u < 44 )
X		printf("%02x %03o %-6s  ", u, u, chr);
X	else 	printf("%02x %03o %s   ", u, u, chr );
X	}
________This_Is_The_END________
if test `wc -l < achart.c` -ne 87; then
	echo 'shar: achart.c was damaged during transit (should have been 87 bytes)'
fi
fi		; : end of overwriting check
exit 0