aboutsummaryrefslogtreecommitdiff
path: root/uxd.c
diff options
context:
space:
mode:
Diffstat (limited to 'uxd.c')
-rw-r--r--uxd.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/uxd.c b/uxd.c
index 3f9d363..612243a 100644
--- a/uxd.c
+++ b/uxd.c
@@ -84,7 +84,8 @@ int hilite_multi = 0; /* -r */
int mono = 0; /* -m */
int display_offset = 0; /* -o */
int seekpos = 0; /* -s */
-int uppercase = 0; /* -u */
+const char *hex_byte_fmt = "%02x"; /* -u */
+const char *hex_word_fmt = "%04x: "; /* " */
void usage(void) {
printf("uxd (Utf-8 heX Dump) v" VERSION " by B. Watson. WTFPL.\n");
@@ -134,7 +135,7 @@ void parse_options(int argc, char **argv) {
seekpos = strtol(optarg, NULL, 0);
break;
case 'u':
- uppercase = 1; break;
+ hex_byte_fmt = "%02X"; hex_word_fmt = "%04X: "; break;
case 'h':
usage(); break;
case 'v':
@@ -227,10 +228,10 @@ void append_left(unsigned char byte, int dash, int fgcolor, int bgcolor) {
char tmpbuf[100];
if(!dump_column)
- sprintf(left_buf, "%04x: ", filepos + display_offset);
+ sprintf(left_buf, hex_word_fmt, filepos + display_offset);
append_color(left_buf, fgcolor, bgcolor);
- sprintf(tmpbuf, "%02x", byte);
+ sprintf(tmpbuf, hex_byte_fmt, byte);
strcat(left_buf, tmpbuf);
dump_column++;