]> err.no Git - varnish/commitdiff
Add two new CLI commands: param.set and param.show.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 19 Aug 2006 20:28:30 +0000 (20:28 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Sat, 19 Aug 2006 20:28:30 +0000 (20:28 +0000)
Eliminate requirement that "help" be first, I was just lazy I guess.

git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@837 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishd/Makefile.am
varnish-cache/bin/varnishd/mgt_cli.c
varnish-cache/bin/varnishd/mgt_cli.h
varnish-cache/bin/varnishd/mgt_param.c [new file with mode: 0644]
varnish-cache/include/cli.h

index 72e82c7f2f8d37f08d3f3da03d358fc0570d9226..41586d9fffcfe18f7d893913b509b8ee4c77f8b9 100644 (file)
@@ -31,6 +31,7 @@ varnishd_SOURCES = \
        mgt_child.c \
        mgt_cli.c \
        mgt_event.c \
+       mgt_param.c \
        mgt_vcc.c \
        rfc2616.c \
        shmlog.c \
index 046c944684084786fca8e288c879e4c0a91674bf..1a835540f231261cce75dd6a500fa110b4e0ebfa 100644 (file)
@@ -104,8 +104,8 @@ mcf_passthru(struct cli *cli, char **av, void *priv)
 
 static struct cli_proto *cli_proto;
 
+/* XXX: what order should this list be in ? */
 static struct cli_proto mgt_cli_proto[] = {
-       { CLI_HELP,             cli_func_help, NULL },  /* must be first */
        { CLI_PING,             cli_func_ping },
        { CLI_SERVER_START,     mcf_server_startstop, NULL },
        { CLI_SERVER_STOP,      mcf_server_startstop, &cli_proto },
@@ -115,6 +115,9 @@ static struct cli_proto mgt_cli_proto[] = {
        { CLI_CONFIG_USE,       mcf_config_use, NULL },
        { CLI_CONFIG_DISCARD,   mcf_config_discard, NULL },
        { CLI_CONFIG_LIST,      mcf_config_list, NULL },
+       { CLI_PARAM_SHOW,       mcf_param_show, NULL },
+       { CLI_PARAM_SET,        mcf_param_set, NULL },
+       { CLI_HELP,             cli_func_help, NULL },
 #if 0
        { CLI_SERVER_RESTART },
        { CLI_ZERO },
@@ -163,8 +166,12 @@ mgt_cli_init(void)
        }
 
        /* Fixup the entry for 'help' entry */
-       assert(!strcmp(cli_proto[0].request, "help"));
-       cli_proto[0].priv = cli_proto;
+       for (u = 0; cli_proto[u].request != NULL; u++) {
+               if (!strcmp(cli_proto[u].request, "help")) {
+                       cli_proto[u].priv = cli_proto;
+                       break;
+               }
+       }
 }
 
 /*--------------------------------------------------------------------
index 0c8f280ba4141bfaf3fc4c09f05ad3671e30d6cc..5b1e76a68057c00daca721588fe7f1f999c7488d 100644 (file)
@@ -5,6 +5,10 @@
 /* mgt_child.c */
 cli_func_t mcf_server_startstop;
 
+/* mgt_param.c */
+cli_func_t mcf_param_show;
+cli_func_t mcf_param_set;
+
 /* mgt_vcc.c */
 cli_func_t mcf_config_load;
 cli_func_t mcf_config_inline;
diff --git a/varnish-cache/bin/varnishd/mgt_param.c b/varnish-cache/bin/varnishd/mgt_param.c
new file mode 100644 (file)
index 0000000..59537ec
--- /dev/null
@@ -0,0 +1,28 @@
+/*
+ * $Id$
+ */
+
+#include <unistd.h>
+
+#include "cli_priv.h"
+#include "mgt.h"
+#include "mgt_cli.h"
+
+void
+mcf_param_show(struct cli *cli, char **av, void *priv)
+{
+
+       (void)cli;
+       (void)av;
+       (void)priv;
+}
+
+void
+mcf_param_set(struct cli *cli, char **av, void *priv)
+{
+
+       (void)cli;
+       (void)av;
+       (void)priv;
+}
+
index 319ec64d603d07c8b2021f27086702c7b46febd6..31fc17ec455ba600d120a7d50e903c803054783f 100644 (file)
        "\tSwitch to the named configuration immediately.",             \
        1, 1
 
+#define CLI_PARAM_SHOW                                                 \
+       "param.show",                                                   \
+       "param.show [<param>]",                                         \
+       "\tShow parameters and their values.",                          \
+       0, 1
+
+#define CLI_PARAM_SET                                                  \
+       "param.set",                                                    \
+       "param.set <param> <value>",                                    \
+       "\tSet parameter value.",                                       \
+       2,2 
+
 #define CLI_SERVER_FREEZE                                              \
        "server.freeze",                                                \
        "server.freeze",                                                \