diff options
author | B. Watson <urchlay@slackware.uk> | 2024-12-12 15:58:24 -0500 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-12-12 15:58:24 -0500 |
commit | 7bf4de8faaf66c25053e9b74a3867a130a1ec67d (patch) | |
tree | 5cef89bad47e324eed64710a5af83d2ed2547b14 | |
parent | 5414bc808430e80139a6debe56ccea15afedb3b6 (diff) | |
download | uxd-7bf4de8faaf66c25053e9b74a3867a130a1ec67d.tar.gz |
join hex bytes with dashes, inside a character
-rw-r--r-- | uxd.1 | 2 | ||||
-rw-r--r-- | uxd.c | 7 |
2 files changed, 5 insertions, 4 deletions
@@ -104,7 +104,7 @@ Printable characters (except the space, U+0020) alternate between green and yell .B \fBpurple\fP Spaces and unprintable characters ("control" characters, newlines, tabs, etc). These are printed as "visible" characters, e.g. ␣ for the space, ↵ for a newline. -Hopefilly this is an improvement over the usual practice of printing these as periods, like +Hopefully this is an improvement over the usual practice of printing these as periods, like standard hex dumpers do. The Unicode BOM (byte order marker, U+FEFF) is printed as a purple letter B. .TP @@ -169,7 +169,7 @@ void append_right(char *str) { strcat(right_buf, str); } -void append_left(unsigned char byte, int fgcolor, int bgcolor) { +void append_left(unsigned char byte, int dash, int fgcolor, int bgcolor) { char tmpbuf[100]; if(!dump_column) @@ -178,8 +178,9 @@ void append_left(unsigned char byte, int fgcolor, int bgcolor) { append_color(left_buf, fgcolor, bgcolor); sprintf(tmpbuf, "%02x", byte); strcat(left_buf, tmpbuf); + if(dash) strcat(left_buf, "-"); append_color_off(left_buf); - strcat(left_buf, " "); + if(!dash) strcat(left_buf, " "); if(dump_column == 7) strcat(left_buf, " "); dump_column++; @@ -290,7 +291,7 @@ int dump_utf8_char(void) { append_color_off(right_buf); for(i = 0; i <= cont_count; i++) { - append_left(bytes[i], fg, bg); + append_left(bytes[i], (i != cont_count), fg, bg); } return 1; |