mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Remove newline option in hex mode
This commit is contained in:
parent
0b55981e52
commit
6d007d39d7
6 changed files with 5 additions and 21 deletions
|
|
@ -46,6 +46,7 @@ The command-line interface is straightforward as reflected in the output from
|
|||
-m, --map <flags> Map special characters
|
||||
-c, --color <code> Colorize tio text
|
||||
-S, --socket <socket> Listen on socket
|
||||
-x, --hex Enable hexadecimal mode
|
||||
-v, --version Display version
|
||||
-h, --help Display help
|
||||
|
||||
|
|
|
|||
|
|
@ -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<code>
|
||||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 <flags> Map special characters\n");
|
||||
printf(" -c, --color <code> Colorize tio text\n");
|
||||
printf(" -S, --socket <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");
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue