mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Fix parsing of timestamp options
This commit is contained in:
parent
8f7bf2fd2c
commit
6831ad0eae
2 changed files with 14 additions and 12 deletions
|
|
@ -31,6 +31,7 @@
|
|||
#include <regex.h>
|
||||
#include <glib.h>
|
||||
#include "configfile.h"
|
||||
#include "timestamp.h"
|
||||
#include "print.h"
|
||||
#include "rs485.h"
|
||||
#include "misc.h"
|
||||
|
|
@ -148,7 +149,6 @@ static void config_get_bool(GKeyFile *key_file, gchar *group, gchar *key, bool *
|
|||
static void config_parse_keys(GKeyFile *key_file, char *group)
|
||||
{
|
||||
char *string = NULL;
|
||||
bool boolean = false;
|
||||
|
||||
config_get_string(key_file, group, "device", &config.device, NULL);
|
||||
config_get_integer(key_file, group, "baudrate", &option.baudrate, 0, INT_MAX);
|
||||
|
|
@ -204,11 +204,9 @@ static void config_parse_keys(GKeyFile *key_file, char *group)
|
|||
g_free((void *)string);
|
||||
string = NULL;
|
||||
}
|
||||
config_get_bool(key_file, group, "timestamp", &boolean);
|
||||
if (boolean == true)
|
||||
config_get_bool(key_file, group, "timestamp", (bool*) &option.timestamp);
|
||||
if (option.timestamp != TIMESTAMP_NONE)
|
||||
{
|
||||
option.timestamp = TIMESTAMP_24HOUR;
|
||||
}
|
||||
config_get_string(key_file, group, "timestamp-format", &string, "24hour", "24hour-start", "24hour-delta", "iso8601", "epoch", NULL);
|
||||
if (string != NULL)
|
||||
{
|
||||
|
|
@ -216,6 +214,7 @@ static void config_parse_keys(GKeyFile *key_file, char *group)
|
|||
g_free((void *)string);
|
||||
string = NULL;
|
||||
}
|
||||
}
|
||||
config_get_integer(key_file, group, "timestamp-timeout", &option.timestamp_timeout, 0, INT_MAX);
|
||||
config_get_bool(key_file, group, "log", &option.log);
|
||||
config_get_string(key_file, group, "log-file", &option.log_filename, NULL);
|
||||
|
|
|
|||
|
|
@ -998,7 +998,10 @@ void options_parse(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 't':
|
||||
if (option.timestamp == TIMESTAMP_NONE)
|
||||
{
|
||||
option.timestamp = TIMESTAMP_24HOUR;
|
||||
}
|
||||
break;
|
||||
|
||||
case OPT_TIMESTAMP_FORMAT:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue