Add independent input and output mode

Replaces -x, --hexadecimal option with --intput-mode and --output-mode
so it is possible to select hex or normal mode for both input and output
independently.

To obtain same behaviour as -x, --hexadecimal use the following
configuration:

input-mode = hex
output-mode = hex
This commit is contained in:
Martin Lund 2024-04-10 14:39:42 +02:00
parent fd6a246908
commit 2fff4d36d0
9 changed files with 254 additions and 78 deletions

View file

@ -30,6 +30,20 @@
#include "timestamp.h"
#include "alert.h"
typedef enum
{
INPUT_MODE_NORMAL,
INPUT_MODE_HEX,
INPUT_MODE_END,
} input_mode_t;
typedef enum
{
OUTPUT_MODE_NORMAL,
OUTPUT_MODE_HEX,
OUTPUT_MODE_END,
} output_mode_t;
/* Options */
struct option_t
{
@ -58,7 +72,8 @@ struct option_t
const char *map;
const char *socket;
int color;
bool hex_mode;
input_mode_t input_mode;
output_mode_t output_mode;
unsigned char prefix_code;
unsigned char prefix_key;
bool prefix_enabled;
@ -84,3 +99,6 @@ void options_parse_final(int argc, char *argv[]);
void line_pulse_duration_option_parse(const char *arg);
enum script_run_t script_run_option_parse(const char *arg);
input_mode_t input_mode_option_parse(const char *arg);
output_mode_t output_mode_option_parse(const char *arg);