summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorVito Caputo <vcaputo@pengaru.com>2023-01-11 13:44:37 -0800
committerVito Caputo <vcaputo@pengaru.com>2023-01-11 22:31:31 -0800
commit320ed9ad22303d942cc6bb76df037044ce71b6ea (patch)
tree63f62a283d62ebe3b4baeff619898449cf72554c /src/main.c
parent01bf40c402f9da50e4282eef722a25c9668efc3c (diff)
main: move args to rototiller_t
Particularly for simple boolean args it's desirable to just access their values directly in the args without any further cooking required. Rather than pointlessly duplicating those cases, just give visibility into the raw args.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/main.c b/src/main.c
index 970ca86..943a8ff 100644
--- a/src/main.c
+++ b/src/main.c
@@ -50,6 +50,7 @@ extern til_fb_ops_t sdl_fb_ops;
static til_fb_ops_t *fb_ops;
typedef struct rototiller_t {
+ til_args_t args;
const til_module_t *module;
til_module_context_t *module_context;
pthread_t thread;
@@ -348,26 +349,25 @@ int main(int argc, const char *argv[])
{
const til_setting_desc_t *failed_desc = NULL;
setup_t setup = {};
- til_args_t args = {};
int r;
exit_if((r = til_init()) < 0,
"unable to initialize libtil: %s", strerror(-r));
- exit_if(til_args_parse(argc, argv, &args) < 0,
+ exit_if(til_args_parse(argc, argv, &rototiller.args) < 0,
"unable to process arguments");
- if (args.help)
+ if (rototiller.args.help)
return print_help() < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
- exit_if((r = setup_from_args(&args, &setup, &failed_desc)) < 0,
+ exit_if((r = setup_from_args(&rototiller.args, &setup, &failed_desc)) < 0,
"unable to use args%s%s%s: %s",
failed_desc ? " for setting \"" : "",
failed_desc ? failed_desc->key : "",
failed_desc ? "\"" : "",
strerror(-r));
- exit_if(r && print_setup_as_args(&setup, !args.gogogo) < 0,
+ exit_if(r && print_setup_as_args(&setup, !rototiller.args.gogogo) < 0,
"unable to print setup");
exit_if(!(rototiller.module = til_lookup_module(til_settings_get_key(setup.module_settings, 0, NULL))),
© All Rights Reserved