diff options
Diffstat (limited to 'listbas.c')
-rw-r--r-- | listbas.c | 13 |
1 files changed, 9 insertions, 4 deletions
@@ -20,16 +20,17 @@ #define C_CYAN 6 int immediate = 0, utf8 = 1, magazine = 0, inv = 0, - color = 1, bold = 0, badtok = 0; + color = 1, bold = 0, badtok = 0, dots = 0; const char **table = ata2utf; FILE *outfh; void print_help(void) { - printf("Usage: %s [-a] [-b] [-i] [-m] [-n] [-v] <inputfile>\n", self); + printf("Usage: %s [-a] [-b] [-d] [-i] [-m] [-n] [-v] <inputfile>\n", self); printf(" -a: output raw ATASCII.\n"); printf(" -b: use bold for color output.\n"); + printf(" -d: use dots instead of Unicode/UTF-8.\n"); printf(" -i: show immediate mode command (line 32768).\n"); printf(" -m: magazine style listing (see a8cat(1)).\n"); printf(" -n: disable color syntax highlighting.\n"); @@ -39,7 +40,7 @@ void print_help(void) { void parse_args(int argc, char **argv) { int opt; - while( (opt = getopt(argc, argv, "viamnbh")) != -1) { + while( (opt = getopt(argc, argv, "viamnbdh")) != -1) { switch(opt) { case 'v': verbose = 1; break; case 'i': immediate = 1; break; @@ -47,6 +48,7 @@ void parse_args(int argc, char **argv) { case 'm': utf8 = 0 ; magazine = 1; color = 0; table = ata2mag; break; case 'n': color = 0; break; case 'b': bold = 1; break; + case 'd': dots = 1; break; case 'h': print_help(); exit(0); default: print_help(); @@ -178,7 +180,10 @@ void print_ata_chr(unsigned char c) { end_inv(c); } } - fputs(table[c & 0x7f], outfh); + if(dots) + fputc(isprint(c & 0x7f) ? c & 0x7f : '.', outfh); + else + fputs(table[c & 0x7f], outfh); } void print_string(unsigned int pos, unsigned int len) { |