From 72640eecc20e9babed3661335e2ea71dd10ee618 Mon Sep 17 00:00:00 2001 From: Tim Segers Date: Fri, 23 Dec 2022 20:01:46 +0100 Subject: Add support for toml-based config file --- src/opendeco-cli.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'src/opendeco-cli.c') 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 #include +#include #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; -- cgit v1.2.3-70-g09d2