summaryrefslogtreecommitdiff
path: root/src/or/confparse.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2013-08-25 12:59:38 -0400
committerNick Mathewson <nickm@torproject.org>2013-09-13 12:36:39 -0400
commita1096fe1802ee3585dd6296b50085017e1928edf (patch)
tree0944be1e8668c421e861ce5da1a5dbaf2a308973 /src/or/confparse.c
parent34ec954f8ef8201fd16942acca55ac19db8ff7b7 (diff)
downloadtor-a1096fe1802ee3585dd6296b50085017e1928edf.tar.gz
tor-a1096fe1802ee3585dd6296b50085017e1928edf.zip
Use commandline parser for other options
These were previously allowed only in the initial position: --help, -h , --version, --digests, --list-torrc-options
Diffstat (limited to 'src/or/confparse.c')
-rw-r--r--src/or/confparse.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/or/confparse.c b/src/or/confparse.c
index 41055791ef..12ab0e4556 100644
--- a/src/or/confparse.c
+++ b/src/or/confparse.c
@@ -79,6 +79,21 @@ config_line_append(config_line_t **lst,
(*lst) = newline;
}
+/** Return the line in <b>lines</b> whose key is exactly <b>key</b>, or NULL
+ * if no such key exists. For handling commandline-only options only; other
+ * options should be looked up in the appropriate data structure. */
+const config_line_t *
+config_line_find(const config_line_t *lines,
+ const char *key)
+{
+ const config_line_t *cl;
+ for (cl = lines; cl; cl = cl->next) {
+ if (!strcmp(cl->key, key))
+ return cl;
+ }
+ return NULL;
+}
+
/** Helper: parse the config string and strdup into key/value
* strings. Set *result to the list, or NULL if parsing the string
* failed. Return 0 on success, -1 on failure. Warn and ignore any