| 1 |
diff --git i/main.c w/main.c |
| 2 |
index 4f070acc..a4344402 100644 |
| 3 |
--- i/main.c |
| 4 |
+++ w/main.c |
| 5 |
@@ -1781,6 +1781,8 @@ int main(int argc,char *argv[]) |
| 6 |
option_error(); |
| 7 |
exit_cleanup(RERR_SYNTAX); |
| 8 |
} |
| 9 |
+ dump_long_options(); |
| 10 |
+ exit(23); |
| 11 |
if (write_batch |
| 12 |
&& poptDupArgv(argc, (const char **)argv, &cooked_argc, (const char ***)&cooked_argv) != 0) |
| 13 |
out_of_memory("main"); |
| 14 |
diff --git i/options.c w/options.c |
| 15 |
index 578507c6..32f60a95 100644 |
| 16 |
--- i/options.c |
| 17 |
+++ w/options.c |
| 18 |
@@ -844,6 +844,50 @@ static struct poptOption long_options[] = { |
| 19 |
{0,0,0,0, 0, 0, 0} |
| 20 |
}; |
| 21 |
|
| 22 |
+void dump_long_options(void) |
| 23 |
+{ |
| 24 |
+ for (int i = 0; i < 251; i++) { |
| 25 |
+ struct poptOption opt = long_options[i]; |
| 26 |
+ printf("long=%s ", opt.longName); |
| 27 |
+ if (opt.shortName == 0) { |
| 28 |
+ printf("short= "); |
| 29 |
+ } else { |
| 30 |
+ printf("short=%c ", opt.shortName); |
| 31 |
+ } |
| 32 |
+ printf("arg="); |
| 33 |
+ switch (opt.argInfo) { |
| 34 |
+ case POPT_ARG_STRING: { |
| 35 |
+ const char** ptr = opt.arg; |
| 36 |
+ if (ptr == NULL) { |
| 37 |
+ printf("\"(null)\"\n"); |
| 38 |
+ } else { |
| 39 |
+ if (*ptr == NULL || strlen(*ptr) == 0) { |
| 40 |
+ printf("\"(null)\"\n"); |
| 41 |
+ } else { |
| 42 |
+ printf("\"%s\"\n", *ptr); |
| 43 |
+ } |
| 44 |
+ } |
| 45 |
+ break; |
| 46 |
+ } |
| 47 |
+ |
| 48 |
+ case POPT_ARG_NONE: |
| 49 |
+ case POPT_ARG_INT: |
| 50 |
+ case POPT_BIT_SET: |
| 51 |
+ case POPT_ARG_VAL: { |
| 52 |
+ const int* ptr = opt.arg; |
| 53 |
+ if (ptr == NULL) { |
| 54 |
+ printf("<nil int>\n"); |
| 55 |
+ } else { |
| 56 |
+ printf("%d\n", *ptr); |
| 57 |
+ } |
| 58 |
+ break; |
| 59 |
+ } |
| 60 |
+ default: |
| 61 |
+ printf("unknown argInfo: %d", opt.argInfo); |
| 62 |
+ } |
| 63 |
+ } |
| 64 |
+} |
| 65 |
+ |
| 66 |
static struct poptOption long_daemon_options[] = { |
| 67 |
/* longName, shortName, argInfo, argPtr, value, descrip, argDesc */ |
| 68 |
{"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 }, |