From 9826fb19815794507cbc55358439758fbf700291 Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Tue, 8 Oct 2019 11:47:43 -0400 Subject: Add a return type for the parsed commandline. Previously it was stored in two outvars, but this is more elegant. I'm going to be expanding this struct in later commits. --- src/app/main/main.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'src/app/main/main.c') diff --git a/src/app/main/main.c b/src/app/main/main.c index 3bdf8f146b..0edda66fd0 100644 --- a/src/app/main/main.c +++ b/src/app/main/main.c @@ -549,10 +549,13 @@ tor_init(int argc, char *argv[]) { /* We search for the "quiet" option first, since it decides whether we * will log anything at all to the command line. */ - config_line_t *opts = NULL, *cmdline_opts = NULL; - const config_line_t *cl; - (void) config_parse_commandline(argc, argv, 1, &opts, &cmdline_opts); - for (cl = cmdline_opts; cl; cl = cl->next) { + parsed_cmdline_t *cmdline; + const config_line_t *cl = NULL; + cmdline = config_parse_commandline(argc, argv, 1); + if (cmdline != NULL) { + cl = cmdline->cmdline_opts; + } + for (; cl; cl = cl->next) { if (!strcmp(cl->key, "--hush")) quiet = 1; if (!strcmp(cl->key, "--quiet") || @@ -569,8 +572,7 @@ tor_init(int argc, char *argv[]) quiet = 1; } } - config_free_lines(opts); - config_free_lines(cmdline_opts); + parsed_cmdline_free(cmdline); } /* give it somewhere to log to initially */ -- cgit v1.2.3-54-g00ecf