home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / compsrcs / misc / volume08 / achart next >
Encoding:
Internet Message Format  |  1991-08-27  |  4.6 KB

  1. From decwrl!purdue!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!csd4.csd.uwm.edu!cs.utexas.edu!uunet!allbery Fri Aug 25 22:47:18 PDT 1989
  2. Article 1057 of comp.sources.misc:
  3. Path: decwrl!purdue!tut.cis.ohio-state.edu!gem.mps.ohio-state.edu!csd4.csd.uwm.edu!cs.utexas.edu!uunet!allbery
  4. From: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  5. Newsgroups: comp.sources.misc
  6. Subject: v08i018: achart.c - 80 * 22 line ASCII/hex/octal/control chart (shar)
  7. Message-ID: <65025@uunet.UU.NET>
  8. Date: 25 Aug 89 22:32:32 GMT
  9. Sender: allbery@uunet.UU.NET
  10. Reply-To: wwg@brambo.UUCP (Warren W. Gay)
  11. Organization: Bramalea Software Inc., Bramalea, Ont.
  12. Lines: 113
  13. Approved: allbery@uunet.UU.NET (Brandon S. Allbery - comp.sources.misc)
  14.  
  15. Posting-number: Volume 8, Issue 18
  16. Submitted-by: wwg@brambo.UUCP (Warren W. Gay)
  17. Archive-name: achart
  18.  
  19. #--------------------------------CUT HERE-------------------------------------
  20. #! /bin/sh
  21. #
  22. # This is a shell archive.  Save this into a file, edit it
  23. # and delete all lines above this comment.  Then give this
  24. # file to sh by executing the command "sh file".  The files
  25. # will be extracted into the current directory owned by
  26. # you with default permissions.
  27. #
  28. # The files contained herein are:
  29. #
  30. # -rw-r--r--   1 wwg      other       2961 Aug 25 15:05 achart.c
  31. #
  32. echo 'x - achart.c'
  33. if test -f achart.c; then echo 'shar: not overwriting achart.c'; else
  34. sed 's/^X//' << '________This_Is_The_END________' > achart.c
  35. X/* ACHART.C -- WWG -- VE3WWG -- 25AUG89 -- Bramalea Software Systems 
  36. X-------------------------------------------------------------------------------
  37. X    This program's distribution status is * UNLIMITED *
  38. X            see below for proof
  39. X-------------------------------------------------------------------------------
  40. X
  41. X    Any copy of this program may be copied again, without constraint,
  42. X    for all intents and purposes conceivable, or no purpose at all.
  43. X
  44. X    It may also be copied for inconceivable purposes, or not copied
  45. X    at all.  It may even be typed in manually again freely with plenty 
  46. X    of errors and perhaps only one or two.  It can be recreated again
  47. X    from scratch, or using parts of this original file.
  48. X
  49. X    It may also be munged, mangled, pillaged, ripped, torn, shreaded,
  50. X    pirated, shared, printed, sold, bought, traded, viewed, deleted,
  51. X    added, merged, stomped on, moved, renamed, recorded, erased,
  52. X    transported, stowed, scented, ignored, loved, hated, backed up,
  53. X    overwritten, edited, studied, exposed, gift wrapped, used, collected,
  54. X    displayed, spun, compressed, squashed, zooed, arced, tared,
  55. X    streched, sheared, rotated, rivited, transmitted and/or received,
  56. X    encrypted, converted, perverted, reverted, confiscated, used as
  57. X    evidence, or passed on in a will (taxes might apply).
  58. X
  59. X    It may be sent/received in ASCII, morse code, baudot, Russian (or
  60. X    any spoken language) and yes, even EBCDIC!
  61. X
  62. X    It may be stored on earth, or in space, your attic, your hard drive, 
  63. X    your sloppy disk, your flippy disk, or in rural Russia. It may also
  64. X    be kept in core memory, on paper or carbons, a coleco adam, vic-20,
  65. X    commodore (if u must), on reel to reel, cassette, bubble memory, 
  66. X    volatile memory, CD, magnetic drum, relays, vacuum tubes, WORM, ROM,
  67. X    EEPROM, EPROM, PROM, Wong, and yes, even an IBM 370 main frame.
  68. X
  69. X    Wait! There's more!
  70. X
  71. X    Even surviving 4004, 8008, 8080, 6502, 6800, and Cosmac ELFs processors
  72. X    need not fear any litigation.
  73. X
  74. X    Distribution and use is unlimited.
  75. X-------------------------------------------------------------------------------    
  76. X*/
  77. X#include "stdio.h"
  78. X#include "ctype.h"
  79. X
  80. Xint main(argc,argv)
  81. Xint argc;
  82. Xchar *argv[];
  83. X    {
  84. X    unsigned short u, v;
  85. X    void show();
  86. X
  87. X    for ( u = 0; u < 22; ++u ) {
  88. X        for ( v = 0; v < 6; ++v )
  89. X            show(u + v * 22);
  90. X        putchar('\n');
  91. X        }
  92. X    }
  93. X
  94. Xvoid show(u)
  95. Xunsigned short u;
  96. X    {
  97. X    char chr[10];
  98. X    static char *name[] = {
  99. X        "nul", "soh", "stx", "etx", "eot", "enq", "ack", "bel", "bs",
  100. X        "ht", "lf", "vt", "ff", "cr", "so", "si", "dle", "dc1", "dc2",
  101. X        "dc3", "dc4", "nak", "syn", "etb", "can", "em", "sub", "esc",
  102. X        "fs", "gs", "rs", "us" };
  103. X
  104. X    if ( u >= 128 )
  105. X        return;
  106. X    else if ( u < 040 )
  107. X        sprintf(chr,"^%c %-3s", (unsigned int) u + '@', name[u] );
  108. X    else if ( u == 040 )
  109. X        strcpy(chr,"space ");
  110. X    else if ( u == 127 )
  111. X        strcpy(chr,"del   ");
  112. X    else if ( u < 44 )
  113. X        sprintf(chr,"%c   ",u);
  114. X    else    {
  115. X        chr[0] = u;
  116. X        chr[1] = 0;
  117. X        }
  118. X    if ( u < 44 )
  119. X        printf("%02x %03o %-6s  ", u, u, chr);
  120. X    else     printf("%02x %03o %s   ", u, u, chr );
  121. X    }
  122. ________This_Is_The_END________
  123. if test `wc -l < achart.c` -ne 87; then
  124.     echo 'shar: achart.c was damaged during transit (should have been 87 bytes)'
  125. fi
  126. fi        ; : end of overwriting check
  127. exit 0
  128.  
  129.  
  130.