aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--uxd.c23
1 files changed, 16 insertions, 7 deletions
diff --git a/uxd.c b/uxd.c
index e675348..dbea5f0 100644
--- a/uxd.c
+++ b/uxd.c
@@ -72,12 +72,22 @@ int special_color = PURPLE;
int cur_normal_hilite = 0;
/* highlight types. HL_NORM_INV is only used for the hex bytes, not
- the human-readable right column. */
+ the human-readable right column. */
#define HL_NORMAL 0
#define HL_NORM_INV 1
#define HL_SPECIAL 2
#define HL_BAD 3
+/* terminal codes for mono highlighting. */
+#define MONO_NORMAL 0
+#define MONO_UNDERLINE 4
+#define MONO_BOLD 1
+#define MONO_REVERSE 7
+
+/* replacement character � is U+FFFD */
+#define PRINT_BAD "�"
+#define PRINT_BOM "B"
+
/* name (read from argv[0]), for error/warning messages. */
const char *self;
@@ -431,14 +441,14 @@ void append_mono(char *buf, int hl_type) {
switch(hl_type) {
case HL_NORMAL:
case HL_NORM_INV:
- code = cur_normal_hilite ? 4 : 0; /* underline : normal */
+ code = cur_normal_hilite ? MONO_UNDERLINE : MONO_NORMAL;
break;
case HL_SPECIAL:
- code = 1; /* bold */
+ code = MONO_BOLD;
break;
default:
case HL_BAD:
- code = 7; /* reverse video */
+ code = MONO_REVERSE;
break;
}
@@ -626,14 +636,13 @@ int dump_utf8_char(void) {
/* decide how to highlight the current character */
if(bad) {
hl_type = HL_BAD;
- /* replacement character � is U+FFFD */
- printable = "�";
+ printable = PRINT_BAD;
} else if(special) {
hl_type = HL_SPECIAL;
printable = get_special(bytes[0]);
} else if(cont_count == 2 && is_bom(bytes)) {
hl_type = HL_SPECIAL;
- printable = "B";
+ printable = PRINT_BOM;
} else {
hl_type = HL_NORMAL;
printable = (char *)bytes;