aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/src/opendeco-cli.c
diff options
context:
space:
mode:
authorGravatar Tim Segers <tsegers@pm.me>2022-12-23 20:01:46 +0100
committerGravatar Tim Segers <tsegers@pm.me>2023-01-02 15:06:03 +0100
commit72640eecc20e9babed3661335e2ea71dd10ee618 (patch)
tree52abbb575b18aeaef4a08728aaaae439aca76b19 /src/opendeco-cli.c
parentc0f2ea4176b967ba902bb5e0e5c4ee3f28530beb (diff)
downloadopendeco-72640eecc20e9babed3661335e2ea71dd10ee618.tar.gz
Add support for toml-based config file
Diffstat (limited to 'src/opendeco-cli.c')
-rw-r--r--src/opendeco-cli.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/opendeco-cli.c b/src/opendeco-cli.c
index 4e21405..e200fcd 100644
--- a/src/opendeco-cli.c
+++ b/src/opendeco-cli.c
@@ -2,6 +2,7 @@
#include <argp.h>
#include <stdlib.h>
+#include <string.h>
#include "opendeco-cli.h"
@@ -47,7 +48,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
arguments->time = arg ? atof(arg) : -1;
break;
case 'g':
- arguments->gas = arg;
+ if (arguments->gas)
+ free(arguments->gas);
+
+ arguments->gas = strdup(arg);
break;
case 'p':
arguments->SURFACE_PRESSURE = arg ? atof(arg) : -1;
@@ -62,7 +66,10 @@ static error_t parse_opt(int key, char *arg, struct argp_state *state)
arguments->gfhigh = arg ? atoi(arg) : 100;
break;
case 'G':
- arguments->decogasses = arg;
+ if (arguments->decogasses)
+ free(arguments->decogasses);
+
+ arguments->decogasses = strdup(arg);
break;
case 'S':
arguments->SWITCH_INTERMEDIATE = 0;