summaryrefslogtreecommitdiff
path: root/src/app/main/main.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2019-10-08 11:47:43 -0400
committerNick Mathewson <nickm@torproject.org>2019-10-17 12:01:40 -0400
commit9826fb19815794507cbc55358439758fbf700291 (patch)
tree23b01ed8c2877ef974fa1c25918a74630dd02da8 /src/app/main/main.c
parent911b16e6e7ba657024734e7a36fad56c22c740a9 (diff)
downloadtor-9826fb19815794507cbc55358439758fbf700291.tar.gz
tor-9826fb19815794507cbc55358439758fbf700291.zip
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.
Diffstat (limited to 'src/app/main/main.c')
-rw-r--r--src/app/main/main.c14
1 files changed, 8 insertions, 6 deletions
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 */