aboutsummaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2008-03-10 12:41:26 +0000
committerPeter Palfrader <peter@palfrader.org>2008-03-10 12:41:26 +0000
commit4118e319c7c77e20bd4a1e200dc22d59bd59195d (patch)
tree1fc3aae36522eb65b8f7177cecdac785c74b4312 /src/or/config.c
parent82f3459490f6b09d1e21b88f9a4d32645bed6a8a (diff)
downloadtor-4118e319c7c77e20bd4a1e200dc22d59bd59195d.tar
tor-4118e319c7c77e20bd4a1e200dc22d59bd59195d.tar.gz
options_init_from_torrc(): Split argv processing into two parts
Split the argv processing loop into two poarts, one that deals with figuring out which conffile to use, and the other that figures out which "command" (hash fingerprint, verify config, list fpr, run tor) the user asked for. There is a third part further down that imports command line args into the config but that is not touched. svn:r13941
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/or/config.c b/src/or/config.c
index ca5724fa0..91483282e 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -3569,12 +3569,24 @@ options_init_from_torrc(int argc, char **argv)
newoptions = tor_malloc_zero(sizeof(or_options_t));
newoptions->_magic = OR_OPTIONS_MAGIC;
options_init(newoptions);
+ newoptions->command = CMD_RUN_TOR;
+
+ for (i = 1; i < argc; ++i) {
+ if (!strcmp(argv[i],"--list-fingerprint")) {
+ newoptions->command = CMD_LIST_FINGERPRINT;
+ } else if (!strcmp(argv[i],"--hash-password")) {
+ newoptions->command = CMD_HASH_PASSWORD;
+ newoptions->command_arg = tor_strdup( (i < argc-1) ? argv[i+1] : "");
+ ++i;
+ } else if (!strcmp(argv[i],"--verify-config")) {
+ newoptions->command = CMD_VERIFY_CONFIG;
+ }
+ }
/* learn config file name */
fname = NULL;
using_default_torrc = 1;
ignore_missing_torrc = 0;
- newoptions->command = CMD_RUN_TOR;
for (i = 1; i < argc; ++i) {
if (i < argc-1 && !strcmp(argv[i],"-f")) {
if (fname) {
@@ -3592,14 +3604,6 @@ options_init_from_torrc(int argc, char **argv)
++i;
} else if (!strcmp(argv[i],"--ignore-missing-torrc")) {
ignore_missing_torrc = 1;
- } else if (!strcmp(argv[i],"--list-fingerprint")) {
- newoptions->command = CMD_LIST_FINGERPRINT;
- } else if (!strcmp(argv[i],"--hash-password")) {
- newoptions->command = CMD_HASH_PASSWORD;
- newoptions->command_arg = tor_strdup( (i < argc-1) ? argv[i+1] : "");
- ++i;
- } else if (!strcmp(argv[i],"--verify-config")) {
- newoptions->command = CMD_VERIFY_CONFIG;
}
}
if (using_default_torrc) {