# the RPM spec file and LSM
V=2.3
-ascii.o: ascii.c splashscreen.h
ascii: ascii.o
+ascii.o: ascii.c splashscreen.h
splashscreen.h: splashscreen
sed <splashscreen >splashscreen.h -e 's/\\/\\\\/g' -e 's/"/\\"/' -e 's/.*/P("&");/'
CFLAGS = -O
clean:
- rm -f ascii ascii.tar* ascii.shar
+ rm -f ascii ascii.tar* ascii.shar ascii.o splashscreen.h
SOURCES = Makefile ascii.c ascii.1 ascii.lsm ascii.spec
*/
-#define REVISION "$Revision: 1.7 $"
+#define REVISION "$Revision: 1.8 $"
#include <unistd.h>
#include <stdio.h>
void
showHelp(FILE *out, char *progname)
{
- fprintf(out,"Usage: $ %s [t] char-alias...\n",progname);
- fprintf(out," $ %s [dxo] \n",progname);
- fprintf(out,"Options:\n");
- fprintf(out," -t \t\t Script-friendly mode with terse output \n");
- fprintf(out," -d \t\t Ascii table in decimal \n");
- fprintf(out," -x \t\t Ascii table in hex \n");
- fprintf(out," -o \t\t Ascii table in octal \n");
- fprintf(out," -h \t\t This help screen\n");
- fprintf(out," -v \t\t Version info\n");
- fprintf(out,"Description:\n");
- fprintf(out,"Prints all aliases of a given ASCII character.
-Args may be single chars, C escape sequences, English names
-caret escapes for control characters, ASCII mnemonics,
-or numeric values in hex/octal/decimal/binary.\n");
-
- exit(0);
-}
-
-/*********************************************************/
-void
-showSplash(void)
-{
+ fprintf(out,"Usage: %s [-dxohv] [-t] [char-alias...]\n", progname);
#define P(s) puts(s);
#include "splashscreen.h"
#undef P
process_options(argc, argv, optstring) ;
- if (help)
+ if (help || argc == optind)
showHelp(stdout, argv[0]);
- else if (argc == optind )
- showSplash();
else {
for(argc--, argv++ ; argc > 0; argv++, argc--)
ascii(*argv) ;
.SH NAME
ascii -- report character aliases
.SH SYNOPSIS
-ascii char-alias...
+ascii [-dxohv] [-t] [char-alias...]
.SH OPTIONS
-A summary of options are included below:
+Called with no options, ascii behaves like `ascii -h'. Options
+are as follows:
.TP
.B \-t
Script-friendly mode, emits only ISO/decimal/hex/octal/binary
.B \-o
Ascii table in octal.
.TP
-.B \-h
+.B \-h, -?
Show summary of options.
.TP
.B \-v
+ -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