summaryrefslogtreecommitdiff
path: root/src/or/config.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/or/config.c')
-rw-r--r--src/or/config.c30
1 files changed, 30 insertions, 0 deletions
diff --git a/src/or/config.c b/src/or/config.c
index 7931a9790d..f7a0d26917 100644
--- a/src/or/config.c
+++ b/src/or/config.c
@@ -1757,6 +1757,31 @@ print_usage(void)
"See man page for options, or http://tor.eff.org/ for documentation.\n");
}
+/** Print all non-obsolete torrc options. */
+static void
+list_torrc_options(void)
+{
+ int i;
+ smartlist_t *lines = smartlist_create();
+ for (i = 0; _option_vars[i].name; ++i) {
+ config_var_t *var = &_option_vars[i];
+ const char *desc;
+ if (var->type == CONFIG_TYPE_OBSOLETE ||
+ var->type == CONFIG_TYPE_LINELIST_V)
+ continue;
+ desc = config_find_description(&options_format, var->name);
+ printf("%s\n", var->name);
+ if (desc) {
+ wrap_string(lines, desc, 76, " ", " ");
+ SMARTLIST_FOREACH(lines, char *, cp, {
+ printf("%s", cp);
+ tor_free(cp);
+ });
+ smartlist_clear(lines);
+ }
+ }
+}
+
/** Last value actually set by resolve_my_address. */
static uint32_t last_resolved_addr = 0;
/**
@@ -2928,6 +2953,11 @@ options_init_from_torrc(int argc, char **argv)
print_usage();
exit(0);
}
+ if (argc > 1 && !strcmp(argv[1], "--list-torrc-options")) {
+ /* For documenting validating whether we've documented everything. */
+ list_torrc_options();
+ exit(0);
+ }
if (argc > 1 && (!strcmp(argv[1],"--version"))) {
printf("Tor version %s.\n",VERSION);