Hello! Some times I need to see russian characters(KOI8-r) in ASCII representation like in *BSD standart utility hexdump (see option -C http://www.freebsd.org/cgi/man.cgi?query=hexdump).
This little patch add option -C, to allow in ASCII representation all non control characters. What do you think about adding this to upstream source? :-) -- Signature invent in progress 22% ##........
diff -rbu vim70.orig/runtime/doc/xxd.1 vim70/runtime/doc/xxd.1 --- vim70.orig/runtime/doc/xxd.1 2006-03-27 12:36:01.000000000 +0200 +++ vim70/runtime/doc/xxd.1 2007-03-03 00:44:43.000000000 +0100 @@ -71,6 +71,9 @@ .RI < cols > octets per line. Default 16 (\-i: 12, \-ps: 30, \-b: 6). Max 256. .TP +.IR "\-C +allow in ASCII representation all non control characters. Usefull for viewing national codepage characters. +.TP .IR \-E " | " \-EBCDIC Change the character encoding in the righthand column from ASCII to EBCDIC. This does not change the hexadecimal representation. The option is diff -rbu vim70.orig/src/xxd/xxd.c vim70/src/xxd/xxd.c --- vim70.orig/src/xxd/xxd.c 2006-04-30 17:24:27.000000000 +0200 +++ vim70/src/xxd/xxd.c 2007-03-03 00:44:29.000000000 +0100 @@ -232,6 +232,7 @@ fprintf(stderr, " -a toggle autoskip: A single '*' replaces nul-lines. Default off.\n"); fprintf(stderr, " -b binary digit dump (incompatible with -p,-i,-r). Default hex.\n"); fprintf(stderr, " -c cols format <cols> octets per line. Default 16 (-i: 12, -ps: 30).\n"); + fprintf(stderr, " -C allow in ASCII representation all non control characters\n"); fprintf(stderr, " -E show characters in EBCDIC. Default ASCII.\n"); fprintf(stderr, " -g number of octets per group in normal output. Default 2.\n"); fprintf(stderr, " -h print this summary.\n"); @@ -446,7 +447,7 @@ FILE *fp, *fpo; int c, e, p = 0, relseek = 1, negseek = 0, revert = 0; int cols = 0, nonzero = 0, autoskip = 0, hextype = HEX_NORMAL; - int ebcdic = 0; + int ebcdic = 0, asciictrl = 0; int octspergrp = -1; /* number of octets grouped in output */ int grplen; /* total chars per octet group */ long length = -1, n = 0, seekoff = 0; @@ -477,6 +478,7 @@ pp = argv[1] + (!STRNCMP(argv[1], "--", 2) && argv[1][2]); if (!STRNCMP(pp, "-a", 2)) autoskip = 1 - autoskip; else if (!STRNCMP(pp, "-b", 2)) hextype = HEX_BITS; + else if (!STRNCMP(pp, "-C", 2)) asciictrl = 1; else if (!STRNCMP(pp, "-u", 2)) hexx = hexxa + 16; else if (!STRNCMP(pp, "-p", 2)) hextype = HEX_POSTSCRIPT; else if (!STRNCMP(pp, "-i", 2)) hextype = HEX_CINCLUDE; @@ -756,7 +758,7 @@ #else (e > 31 && e < 127) #endif - ? e : '.'; + ? e : asciictrl && !iscntrl(e) ? e : '.'; if (e) nonzero++; n++;