From 7d15a7935594fd426bf79e57e2985cc8549f0eee Mon Sep 17 00:00:00 2001 From: "David M. Syzdek" Date: Mon, 28 Mar 2022 14:52:14 -0800 Subject: tinyrad: updating arguments to tru_cli_parse() --- src/tru/tinyradutil.c | 7 ++++--- src/tru/tinyradutil.h | 3 ++- src/tru/widget-config.c | 2 +- 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[]) if (!(cnf->widget)) { // process common cli options - if ((rc = tru_cli_parse(cnf, argc, argv, short_opt, long_opt)) != 0) + if ((rc = tru_cli_parse(cnf, argc, argv, short_opt, long_opt, &tru_usage)) != 0) { tru_cleanup(cnf); return((rc == 0) ? 0 : 1); @@ -299,7 +299,8 @@ tru_cli_parse( int argc, char * const * argv, const char * short_opt, - const struct option * long_opt ) + const struct option * long_opt, + int (*usage_func)(TinyRadUtilConf * cnf, const char * short_opt ) ) { int c; int opt_index; @@ -323,7 +324,7 @@ tru_cli_parse( return(TRU_GETOPT_ERROR); case 'h': - tru_usage(cnf, short_opt); + usage_func(cnf, short_opt); return(TRU_GETOPT_EXIT); 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( int argc, char * const * argv, const char * short_opt, - const struct option * long_opt ); + const struct option * long_opt, + int (*usage_func)(TinyRadUtilConf * cnf, const char * short_opt ) ); 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( static struct option long_opt[] = { TRU_DICT_LONG TRU_COMMON_LONG }; // process widget cli options - if ((rc = tru_cli_parse(cnf, cnf->argc, cnf->argv, short_opt, long_opt)) != 0) + if ((rc = tru_cli_parse(cnf, cnf->argc, cnf->argv, short_opt, long_opt, &tru_usage)) != 0) { return((rc == 0) ? 0 : 1); }; 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( static struct option long_opt[] = { TRU_DICT_LONG TRU_COMMON_LONG }; // process widget cli options - if ((rc = tru_cli_parse(cnf, cnf->argc, cnf->argv, short_opt, long_opt)) != 0) + if ((rc = tru_cli_parse(cnf, cnf->argc, cnf->argv, short_opt, long_opt, &tru_usage)) != 0) { return((rc == 0) ? 0 : 1); }; -- cgit v1.2.3