aboutsummaryrefslogtreecommitdiff
path: root/uxd.c
diff options
context:
space:
mode:
Diffstat (limited to 'uxd.c')
-rw-r--r--uxd.c25
1 files changed, 18 insertions, 7 deletions
diff --git a/uxd.c b/uxd.c
index a11347f..9926386 100644
--- a/uxd.c
+++ b/uxd.c
@@ -157,6 +157,9 @@ int restore_term = 0; /* -T only */
int java_mode = 0; /* -j */
int wtf8_mode = 0; /* -w */
int permissive = 0; /* -l */
+int skip_ascii = 0; /* -a */
+
+int line_all_ascii = 1; /* used by -a */
/* stats for -i option */
long byte_count = 0;
@@ -284,8 +287,10 @@ void parse_args(int argc, char **argv) {
version();
}
- while((opt = my_getopt(argc, argv, "jwptTd:1ic:nbl:rmo:S:s:uhv")) != -1) {
+ while((opt = my_getopt(argc, argv, "ajwptTd:1ic:nbl:rmo:S:s:uhv")) != -1) {
switch(opt) {
+ case 'a':
+ skip_ascii = 1; break;
case 'j':
java_mode = 1; break;
case 'w':
@@ -422,19 +427,23 @@ void set_self(const char *argv0) {
void print_line(void) {
int spacing = MAX_DUMP_COLS - dump_column;
+ int skip = skip_ascii ? line_all_ascii : 0;
- printf("%s", left_buf);
+ if(!skip) {
+ printf("%s", left_buf);
- /* line up the rightmost field (human-readable), for the partial
- line at the end of the output (if there is one). */
- while(spacing--) printf(" ");
- if(dump_column < (MAX_DUMP_COLS / 2)) putchar(' ');
+ /* line up the rightmost field (human-readable), for the partial
+ line at the end of the output (if there is one). */
+ while(spacing--) printf(" ");
+ if(dump_column < (MAX_DUMP_COLS / 2)) putchar(' ');
- printf(" %s\n", right_buf);
+ printf(" %s\n", right_buf);
+ }
/* clear the buffers, start a new line */
left_buf[0] = right_buf[0] = '\0';
dump_column = 0;
+ line_all_ascii = 1;
}
void next_normal_hilite(void) {
@@ -726,6 +735,8 @@ int dump_utf8_char(void) {
bad = 1;
}
+ if(bad || cont_count) line_all_ascii = 0;
+
/* read and validate the continuation bytes, if any */
for(i = 0; i < cont_count; i++) {
int cb;