diff --git a/README.md b/README.md index 594d2d6..9595a9a 100644 --- a/README.md +++ b/README.md @@ -46,6 +46,7 @@ The command-line interface is straightforward as reflected in the output from -m, --map Map special characters -c, --color Colorize tio text -S, --socket Listen on socket + -x, --hex Enable hexadecimal mode -v, --version Display version -h, --help Display help diff --git a/man/tio.1.in b/man/tio.1.in index b21ab03..7719944 100644 --- a/man/tio.1.in +++ b/man/tio.1.in @@ -120,12 +120,7 @@ If defining more than one flag, the flags must be comma separated. .TP .BR \-x ", " \-\-hex -Start in hexadecimal mode. - -.TP -.BR \-\-newline-in-hex - -Interpret new line characters ('\\r', '\\n') in hexadecimal mode. +Enable hexadecimal mode. .TP .BR \-c ", " "\-\-color " \fI @@ -194,8 +189,6 @@ Show version .TP In hexadecimal mode each incoming byte is printed out as a hexadecimal value. .TP -By default there is \fBno new line\fR in this mode, but it can be turned on using the \fB--newline-in-hex\fR option. -.TP Bytes can be sent in this mode by typing the \fBtwo-character hexadecimal\fR representation of the value, e.g.: to send \fI0xA\fR you must type \fI0a\fR or \fI0A\fR. .SH "CONFIGURATION" diff --git a/src/options.c b/src/options.c index f420a3c..4074109 100644 --- a/src/options.c +++ b/src/options.c @@ -62,7 +62,6 @@ struct option_t option = .map = "", .color = -1, .hex_mode = false, - .newline_in_hex = false, }; void print_help(char *argv[]) @@ -86,8 +85,7 @@ void print_help(char *argv[]) printf(" -m, --map Map special characters\n"); printf(" -c, --color Colorize tio text\n"); printf(" -S, --socket Listen on socket\n"); - printf(" -x, --hex Start in hexadecimal mode\n"); - printf(" --newline-in-hex Interpret new line characters in hex mode\n"); + printf(" -x, --hex Enable hexadecimal mode\n"); printf(" -v, --version Display version\n"); printf(" -h, --help Display help\n"); printf("\n"); @@ -200,7 +198,6 @@ void options_parse(int argc, char *argv[]) {"map", required_argument, 0, 'm' }, {"color", required_argument, 0, 'c' }, {"hex", no_argument, 0, 'x' }, - {"newline-in-hex", no_argument, 0, OPT_NEWLINE_IN_HEX }, {"version", no_argument, 0, 'v' }, {"help", no_argument, 0, 'h' }, {0, 0, 0, 0 } @@ -311,10 +308,6 @@ void options_parse(int argc, char *argv[]) option.hex_mode = true; break; - case OPT_NEWLINE_IN_HEX: - option.newline_in_hex = true; - break; - case 'v': printf("tio v%s\n", VERSION); printf("Copyright (c) 2014-2022 Martin Lund\n"); diff --git a/src/options.h b/src/options.h index 9a854a7..b9bbcf0 100644 --- a/src/options.h +++ b/src/options.h @@ -37,8 +37,6 @@ enum timestamp_t const char* timestamp_token(enum timestamp_t timestamp); enum timestamp_t timestamp_option_parse(const char *arg); -#define OPT_NEWLINE_IN_HEX 1000 // "short" option for --newline-in-hex - /* Options */ struct option_t { @@ -59,7 +57,6 @@ struct option_t const char *socket; int color; bool hex_mode; - bool newline_in_hex; }; extern struct option_t option; diff --git a/src/print.c b/src/print.c index 05fa9f7..88ba881 100644 --- a/src/print.c +++ b/src/print.c @@ -29,7 +29,7 @@ char ansi_format[30]; void print_hex(char c) { - if (((c == '\n') || (c == '\r')) && option.newline_in_hex) + if ((c == '\n') || (c == '\r')) { printf("%c", c); } diff --git a/src/tty.c b/src/tty.c index e77c7aa..d3d2633 100644 --- a/src/tty.c +++ b/src/tty.c @@ -687,6 +687,7 @@ int tty_connect(void) if (option.timestamp) next_timestamp = true; + /* Manage print output mode */ if (option.hex_mode) { print = print_hex; @@ -697,7 +698,6 @@ int tty_connect(void) { print = print_normal; print_mode = NORMAL; - tio_printf("Switched to normal mode"); } /* Save current port settings */