diff options
| -rw-r--r-- | Makefile | 2 | ||||
| -rw-r--r-- | usage.c | 1 | ||||
| -rw-r--r-- | uxd.1 | 11 | ||||
| -rw-r--r-- | uxd.c | 24 | ||||
| -rw-r--r-- | uxd.rst | 7 | ||||
| -rw-r--r-- | ver.rst | 2 | 
6 files changed, 40 insertions, 7 deletions
| @@ -23,7 +23,7 @@ GZIP_MAN=yes  #  ### No user-serviceable parts below. -VERSION=0.3.0 +VERSION=1.0.0  DEFINES=-DVERSION='"$(VERSION)"'  WARNFLAGS=-std=c89 -Wall -pedantic -Wextra @@ -2,6 +2,7 @@ char *usage_opts[] = {  	"  --: no more options.",  	"  -1: don't alternate colors.",  	"  -a: don't dump ASCII-only lines.", +	"  -A: ASCII output instead of UTF-8.",  	"  -b: bold color output.",  	"  -c nnnnn: colors (1 to 5 digits, 0 to 7).",  	"  -d data: dump this data instead of a file.", @@ -27,7 +27,7 @@ level margin: \\n[rst2man-indent\\n[rst2man-indent-level]]  .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]]  .in \\n[rst2man-indent\\n[rst2man-indent-level]]u  .. -.TH "UXD" 1 "2024-12-24" "0.3.0" "Urchlay's Utilities" +.TH "UXD" 1 "2024-12-24" "1.0.0" "Urchlay's Utilities"  .SH NAME  uxd \- UTF-8 hex dumper  .SH SYNOPSIS @@ -100,6 +100,15 @@ Don\(aqt dump lines that consist entirely of ASCII characters (codepoints  .  .INDENT 0.0  .TP +.B  \-A +ASCII output. Unprintable characters and UTF\-8 sequences are +rendered as periods (like \fBxxd\fP does). Also, spaces are rendered +as spaces rather than the ␣ character. +.UNINDENT +.\" ASCII output instead of UTF-8. +. +.INDENT 0.0 +.TP  .B  \-b  Bold output. This may be more or less readable, depending on your  terminal and its color settings. Ignored if \fB\-m\fP given. @@ -158,6 +158,7 @@ int java_mode = 0;    /* -j */  int wtf8_mode = 0;    /* -w */  int permissive = 0;   /* -l */  int skip_ascii = 0;   /* -a */ +int dot_mode = 0;     /* -A */  int line_all_ascii = 1; /* used by -a */ @@ -292,8 +293,10 @@ void parse_args(int argc, char **argv) {  			version();  	} -	while((opt = my_getopt(argc, argv, "ajwptTd:1ic:nbl:rmo:S:s:uhv")) != -1) { +	while((opt = my_getopt(argc, argv, "AajwptTd:1ic:nbl:rmo:S:s:uhv")) != -1) {  		switch(opt) { +			case 'A': +				dot_mode = 1; break;  			case 'a':  				skip_ascii = 1; break;  			case 'j': @@ -420,8 +423,13 @@ void parse_options(int argc, char **argv) {  }  char *get_special(unsigned char c) { -	if(c == 0x7f) return "⌦"; /* tab */ -	if(c <= ' ') return special_symbols[c]; +	if(dot_mode) { +		if(c == 0x7f || c < ' ') return "."; +		if(c == ' ') return " "; +	} else { +		if(c == 0x7f) return "⌦"; /* tab */ +		if(c <= ' ') return special_symbols[c]; +	}  	return "?"; /* should never happen */  } @@ -798,7 +806,15 @@ int dump_utf8_char(void) {  	/* human-readable (right) column: */  	append_hilite(right_buf, hl_type); -	append_right(printable); + +	if(dot_mode && (bad || cont_count)) { +		for(i = 0; i <= cont_count; i++) { +			append_right("."); +		} +	} else { +		append_right(printable); +	} +  	append_hilite_off(right_buf);  	/* hex columns: */ @@ -83,6 +83,13 @@ Also, a decimal point can be used: **1.5K** is 1500 bytes, **1.5k** is  .. don't dump ASCII-only lines. +-A +   ASCII output. Unprintable characters and UTF-8 sequences are +   rendered as periods (like **xxd** does). Also, spaces are rendered +   as spaces rather than the ␣ character. + +.. ASCII output instead of UTF-8. +  -b    Bold output. This may be more or less readable, depending on your    terminal and its color settings. Ignored if **-m** given. @@ -1 +1 @@ -.. |version| replace:: 0.3.0 +.. |version| replace:: 1.0.0 | 
