* v2.2 November 1997 -- merge in more changes by Ioannis Tambouras.
* v2.3 November 1997 -- incorporated Colin Plumb's splash-screen idea.
* v2.4 December 1998 -- additions by Brian Ginsbach.
+ * v2.5 -- -s option by David N. Welton.
*
* Tries to interpret arguments as names or aliases of ascii characters
* and dumps out *all* the aliases of each. Accepts literal characters,
*/
-#define REVISION "$Revision: 1.10 $"
+#define REVISION "$Revision: 1.11 $"
#include <unistd.h>
#include <stdio.h>
static unsigned char terse = 0;
static unsigned char help = 0;
+static unsigned char line = 0;
enum { decimal, hex, octal } mode;
case 't':
terse = 1;
break;
+ case 's':
+ terse=1;
+ line=1;
+ break;
case 'd':
print_table(decimal);
exit(0);
if (len == 1)
{ speak(str[0]); return; }
+ /* process multiple letters */
+ if (line == 1) {
+ for (ch = 0; ch < len; ch ++) {
+ speak(str[ch]);
+ }
+ return;
+ }
+
/* interpret ^-escapes as control-character notation */
if (strcmp(str, "^?") == 0)
{ speak(0x7F); return; }
int argc;
char **argv;
{
- char *optstring="thvxod" ;
+ char *optstring="tshvxod" ;
process_options(argc, argv, optstring) ;
if (help || argc == optind)
showHelp(stdout, argv[0]);
- else {
- for(argc--, argv++ ; argc > 0; argv++, argc--)
- ascii(*argv) ;
- }
+ else
+ while (optind < argc)
+ ascii(argv[optind++]);
exit(0);
}
/******************************************************************/
Script-friendly mode, emits only ISO/decimal/hex/octal/binary
encodings of the character.
.TP
+.B \-s
+Parse multiple characters. Convenient way of parsing strings.
+.TP
.B \-d
Ascii table in decimal.
.TP
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 -s option will not recognize 'long' names, as it cannot
+differentiate them from other parts of the string.
.P
For correct results, be careful to stringize or quote shell metacharacters
in arguments (especially backslash).
enhancements.
Brian J. Ginsbach <ginsbach@sgi.com> fixed several bugs and expanded the
man page.
+David N. Welton <davidw@efn.org> added the -s option.
\ No newline at end of file