From 8dbe95d5615de2c5819f35ffeea393ee881888ad Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Wed, 12 Nov 1997 21:14:54 +0000 Subject: [PATCH] Improved splashscreen. --- Makefile | 4 ++-- ascii.c | 29 +++-------------------------- ascii.xml | 7 ++++--- splashscreen | 5 +++++ 4 files changed, 14 insertions(+), 31 deletions(-) diff --git a/Makefile b/Makefile index 5e52d0c..09657c9 100644 --- a/Makefile +++ b/Makefile @@ -4,8 +4,8 @@ # 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.h -e 's/\\/\\\\/g' -e 's/"/\\"/' -e 's/.*/P("&");/' @@ -13,7 +13,7 @@ splashscreen.h: splashscreen 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 diff --git a/ascii.c b/ascii.c index 724ba52..5bd8e79 100644 --- a/ascii.c +++ b/ascii.c @@ -24,7 +24,7 @@ */ -#define REVISION "$Revision: 1.7 $" +#define REVISION "$Revision: 1.8 $" #include #include @@ -283,28 +283,7 @@ char *str; 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 @@ -611,10 +590,8 @@ char **argv; 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) ; diff --git a/ascii.xml b/ascii.xml index b5c2bd0..4424700 100644 --- a/ascii.xml +++ b/ascii.xml @@ -2,9 +2,10 @@ .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 @@ -19,7 +20,7 @@ Ascii table in hex. .B \-o Ascii table in octal. .TP -.B \-h +.B \-h, -? Show summary of options. .TP .B \-v diff --git a/splashscreen b/splashscreen index cae404f..d18a0f4 100644 --- a/splashscreen +++ b/splashscreen @@ -1,3 +1,8 @@ + -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.43.0