Commit 4127ffa3 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a secret, and decisively undocumented -x option to varnishd,

which only does something if -DDIAGNOSTIC was configured.

First secret superpower is "-x dumpmdoc" which emits a -mdoc suitable
table of all run-time parameters, which can be absorbed into the
varnishd.1 manual page, so we do not have to maintain the text in
two different places.



git-svn-id: http://www.varnish-cache.org/svn/trunk@4526 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent efcd4d04
......@@ -63,6 +63,7 @@ void mgt_cli_close_all(void);
void MCF_ParamSync(void);
void MCF_ParamInit(struct cli *);
void MCF_ParamSet(struct cli *, const char *param, const char *val);
void MCF_DumpMdoc(void);
/* mgt_vcc.c */
void mgt_vcc_init(void);
......
......@@ -1022,3 +1022,66 @@ MCF_ParamInit(struct cli *cli)
params = &master;
}
/*--------------------------------------------------------------------*/
#ifdef DIAGNOSTICS
void
MCF_DumpMdoc(void)
{
const struct parspec *pp;
const char *p, *q;
int i;
printf(".Bl -tag -width 4n\n");
for (i = 0; i < nparspec; i++) {
pp = parspec[i];
printf(".It Va %s\n", pp->name);
if (pp->units != NULL && *pp->units != '\0')
printf("Units:\n.Dv %s\n.br\n", pp->units);
printf("Default:\n.Dv %s\n.br\n", pp->def);
/*
* XXX: we should mark the params with one/two flags
* XXX: that say if ->min/->max are valid, so we
* XXX: can emit those also in help texts.
*/
if (pp->flags) {
printf("Flags:\n.Dv \"");
q = "";
if (pp->flags & DELAYED_EFFECT) {
printf("%sdelayed", q);
q = ", ";
}
if (pp->flags & MUST_RESTART) {
printf("%smust_restart", q);
q = ", ";
}
if (pp->flags & MUST_RELOAD) {
printf("%smust_reload", q);
q = ", ";
}
if (pp->flags & EXPERIMENTAL) {
printf("%sexperimental", q);
q = ", ";
}
printf("\"\n.br\n");
}
printf(".Pp\n");
for (p = pp->descr; *p; p++) {
if (*p == '\n' && p[1] =='\0')
break;
if (*p == '\n' && p[1] =='\n') {
printf("\n.Pp\n");
p++;
} else if (*p == '\n') {
printf("\n.br\n");
} else {
printf("%c", *p);
}
}
printf("\n.Pp\n");
}
printf(".El\n");
}
#endif /* DIAGNOSTICS */
......@@ -582,7 +582,7 @@ main(int argc, char * const *argv)
cli_check(cli);
while ((o = getopt(argc, argv,
"a:b:Cdf:Fg:h:i:l:M:n:P:p:S:s:T:t:u:Vw:")) != -1)
"a:b:Cdf:Fg:h:i:l:M:n:P:p:S:s:T:t:u:Vx:w:")) != -1)
switch (o) {
case 'a':
MCF_ParamSet(cli, "listen_address", optarg);
......@@ -652,6 +652,15 @@ main(int argc, char * const *argv)
case 'V':
varnish_version("varnishd");
exit(0);
case 'x':
#ifdef DIAGNOSTICS
if (!strcmp(optarg, "dumpmdoc")) {
MCF_DumpMdoc();
exit (0);
}
#endif /* DIAGNOSTICS */
usage();
break;
case 'w':
tackle_warg(optarg);
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment