diff options
| author | David M. Syzdek <david@syzdek.net> | 2022-03-28 14:52:14 -0800 |
|---|---|---|
| committer | David M. Syzdek <david@syzdek.net> | 2022-03-28 14:52:14 -0800 |
| commit | 7d15a7935594fd426bf79e57e2985cc8549f0eee (patch) | |
| tree | 03b8c3420e6d5f8ee3a8f1a970159abca0a0f8ce | |
| parent | 77568e2cc912644bada5ad3b406bedc34753fca9 (diff) | |
| download | tinyrad-7d15a7935594fd426bf79e57e2985cc8549f0eee.tar.gz tinyrad-7d15a7935594fd426bf79e57e2985cc8549f0eee.tar.bz2 tinyrad-7d15a7935594fd426bf79e57e2985cc8549f0eee.tar.xz tinyrad-7d15a7935594fd426bf79e57e2985cc8549f0eee.zip | |
tinyrad: updating arguments to tru_cli_parse()
| -rw-r--r-- | src/tru/tinyradutil.c | 7 | ||||
| -rw-r--r-- | src/tru/tinyradutil.h | 3 | ||||
| -rw-r--r-- | src/tru/widget-config.c | 2 | ||||
| -rw-r--r-- | src/tru/widget-dict.c | 2 |
4 files changed, 8 insertions, 6 deletions
diff --git a/src/tru/tinyradutil.c b/src/tru/tinyradutil.c index b5c709e..6a77ec4 100644 --- a/src/tru/tinyradutil.c +++ b/src/tru/tinyradutil.c | |||
| @@ -176,7 +176,7 @@ int main(int argc, char * argv[]) | |||
| 176 | if (!(cnf->widget)) | 176 | if (!(cnf->widget)) |
| 177 | { | 177 | { |
| 178 | // process common cli options | 178 | // process common cli options |
| 179 | if ((rc = tru_cli_parse(cnf, argc, argv, short_opt, long_opt)) != 0) | 179 | if ((rc = tru_cli_parse(cnf, argc, argv, short_opt, long_opt, &tru_usage)) != 0) |
| 180 | { | 180 | { |
| 181 | tru_cleanup(cnf); | 181 | tru_cleanup(cnf); |
| 182 | return((rc == 0) ? 0 : 1); | 182 | return((rc == 0) ? 0 : 1); |
| @@ -299,7 +299,8 @@ tru_cli_parse( | |||
| 299 | int argc, | 299 | int argc, |
| 300 | char * const * argv, | 300 | char * const * argv, |
| 301 | const char * short_opt, | 301 | const char * short_opt, |
| 302 | const struct option * long_opt ) | 302 | const struct option * long_opt, |
| 303 | int (*usage_func)(TinyRadUtilConf * cnf, const char * short_opt ) ) | ||
| 303 | { | 304 | { |
| 304 | int c; | 305 | int c; |
| 305 | int opt_index; | 306 | int opt_index; |
| @@ -323,7 +324,7 @@ tru_cli_parse( | |||
| 323 | return(TRU_GETOPT_ERROR); | 324 | return(TRU_GETOPT_ERROR); |
| 324 | 325 | ||
| 325 | case 'h': | 326 | case 'h': |
| 326 | tru_usage(cnf, short_opt); | 327 | usage_func(cnf, short_opt); |
| 327 | return(TRU_GETOPT_EXIT); | 328 | return(TRU_GETOPT_EXIT); |
| 328 | 329 | ||
| 329 | case '?': | 330 | case '?': |
diff --git a/src/tru/tinyradutil.h b/src/tru/tinyradutil.h index d816f73..b3c9b18 100644 --- a/src/tru/tinyradutil.h +++ b/src/tru/tinyradutil.h | |||
| @@ -182,7 +182,8 @@ tru_cli_parse( | |||
| 182 | int argc, | 182 | int argc, |
| 183 | char * const * argv, | 183 | char * const * argv, |
| 184 | const char * short_opt, | 184 | const char * short_opt, |
| 185 | const struct option * long_opt ); | 185 | const struct option * long_opt, |
| 186 | int (*usage_func)(TinyRadUtilConf * cnf, const char * short_opt ) ); | ||
| 186 | 187 | ||
| 187 | 188 | ||
| 188 | int | 189 | int |
diff --git a/src/tru/widget-config.c b/src/tru/widget-config.c index e1eaa68..a90dc1d 100644 --- a/src/tru/widget-config.c +++ b/src/tru/widget-config.c | |||
| @@ -62,7 +62,7 @@ tru_widget_config( | |||
| 62 | static struct option long_opt[] = { TRU_DICT_LONG TRU_COMMON_LONG }; | 62 | static struct option long_opt[] = { TRU_DICT_LONG TRU_COMMON_LONG }; |
| 63 | 63 | ||
| 64 | // process widget cli options | 64 | // process widget cli options |
| 65 | if ((rc = tru_cli_parse(cnf, cnf->argc, cnf->argv, short_opt, long_opt)) != 0) | 65 | if ((rc = tru_cli_parse(cnf, cnf->argc, cnf->argv, short_opt, long_opt, &tru_usage)) != 0) |
| 66 | { | 66 | { |
| 67 | return((rc == 0) ? 0 : 1); | 67 | return((rc == 0) ? 0 : 1); |
| 68 | }; | 68 | }; |
diff --git a/src/tru/widget-dict.c b/src/tru/widget-dict.c index 8318af4..8bf52ac 100644 --- a/src/tru/widget-dict.c +++ b/src/tru/widget-dict.c | |||
| @@ -62,7 +62,7 @@ tru_widget_dict( | |||
| 62 | static struct option long_opt[] = { TRU_DICT_LONG TRU_COMMON_LONG }; | 62 | static struct option long_opt[] = { TRU_DICT_LONG TRU_COMMON_LONG }; |
| 63 | 63 | ||
| 64 | // process widget cli options | 64 | // process widget cli options |
| 65 | if ((rc = tru_cli_parse(cnf, cnf->argc, cnf->argv, short_opt, long_opt)) != 0) | 65 | if ((rc = tru_cli_parse(cnf, cnf->argc, cnf->argv, short_opt, long_opt, &tru_usage)) != 0) |
| 66 | { | 66 | { |
| 67 | return((rc == 0) ? 0 : 1); | 67 | return((rc == 0) ? 0 : 1); |
| 68 | }; | 68 | }; |
