Implement --verify-config command-line option to fix bug 69.

svn:r4182
This commit is contained in:
Nick Mathewson 2005-05-07 04:49:09 +00:00
parent cee7c5988c
commit bc51c8b074
3 changed files with 9 additions and 0 deletions

View File

@ -1799,6 +1799,8 @@ init_from_config(int argc, char **argv)
newoptions->command = CMD_HASH_PASSWORD; newoptions->command = CMD_HASH_PASSWORD;
newoptions->command_arg = tor_strdup( (i < argc-1) ? argv[i+1] : ""); newoptions->command_arg = tor_strdup( (i < argc-1) ? argv[i+1] : "");
++i; ++i;
} else if (!strcmp(argv[i],"--verify-config")) {
newoptions->command = CMD_VERIFY_CONFIG;
} }
} }

View File

@ -1409,6 +1409,9 @@ void nt_service_main(void)
case CMD_HASH_PASSWORD: case CMD_HASH_PASSWORD:
do_hash_password(); do_hash_password();
break; break;
case CMD_VERIFY_CONFIG:
printf("Configuration was valid\n");
break;
default: default:
log_fn(LOG_ERR, "Illegal command number %d: internal error.", get_options()->command); log_fn(LOG_ERR, "Illegal command number %d: internal error.", get_options()->command);
} }
@ -1594,6 +1597,9 @@ int tor_main(int argc, char *argv[]) {
case CMD_HASH_PASSWORD: case CMD_HASH_PASSWORD:
do_hash_password(); do_hash_password();
break; break;
case CMD_VERIFY_CONFIG:
printf("Configuration was valid\n");
break;
default: default:
log_fn(LOG_ERR, "Illegal command number %d: internal error.", log_fn(LOG_ERR, "Illegal command number %d: internal error.",
get_options()->command); get_options()->command);

View File

@ -954,6 +954,7 @@ typedef struct {
/** What should the tor process actually do? */ /** What should the tor process actually do? */
enum { enum {
CMD_RUN_TOR=0, CMD_LIST_FINGERPRINT, CMD_HASH_PASSWORD, CMD_RUN_TOR=0, CMD_LIST_FINGERPRINT, CMD_HASH_PASSWORD,
CMD_VERIFY_CONFIG,
} command; } command;
const char *command_arg; /**< Argument for command-line option. */ const char *command_arg; /**< Argument for command-line option. */