From: phk Date: Sun, 15 Jun 2008 09:57:28 +0000 (+0000) Subject: Hash out more files and cmd functions X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a04db4dc512e6aaecf213c98f898204a29456d77;p=varnish Hash out more files and cmd functions git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2667 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishtest/Makefile b/varnish-cache/bin/varnishtest/Makefile index cf8b40dd..f704e3b0 100644 --- a/varnish-cache/bin/varnishtest/Makefile +++ b/varnish-cache/bin/varnishtest/Makefile @@ -2,6 +2,10 @@ PROG = vtc SRCS += vtc.c SRCS += vtc_server.c +SRCS += vtc_client.c +SRCS += vtc_vcl.c +SRCS += vtc_stats.c +SRCS += vtc_varnish.c CFLAGS += -g diff --git a/varnish-cache/bin/varnishtest/vtc.c b/varnish-cache/bin/varnishtest/vtc.c index ae9ae16e..f2f0cf31 100644 --- a/varnish-cache/bin/varnishtest/vtc.c +++ b/varnish-cache/bin/varnishtest/vtc.c @@ -76,7 +76,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) p++; } else if (*p == '{') { /* Braces */ nest_brace = 0; - token_s[tn] = p + 1; + token_s[tn] = p; for (; *p != '\0'; p++) { if (*p == '{') nest_brace++; @@ -86,8 +86,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) } } assert(*p == '}'); - token_e[tn++] = p; - p++; /* Swallow closing brace */ + token_e[tn++] = ++p; } else { /* other tokens */ token_s[tn] = p; for (; *p != '\0' && !isspace(*p); p++) @@ -119,20 +118,21 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) * Execute a file */ -static void -cmd_bogo(char **av, void *priv) +void +cmd_dump(char **av, void *priv) { - printf("cmd_bogo(%p)\n", priv); + + printf("cmd_dump(%p)\n", priv); while (*av) printf("\t<%s>\n", *av++); } static struct cmds cmds[] = { { "server", cmd_server }, - { "client", cmd_bogo }, - { "vcl", cmd_bogo }, - { "stats", cmd_bogo }, - { "varnish", cmd_bogo }, + { "client", cmd_client }, + { "vcl", cmd_vcl }, + { "stats", cmd_stats }, + { "varnish", cmd_varnish }, { NULL, NULL } }; diff --git a/varnish-cache/bin/varnishtest/vtc.h b/varnish-cache/bin/varnishtest/vtc.h index b73f2d5d..0b8d3c38 100644 --- a/varnish-cache/bin/varnishtest/vtc.h +++ b/varnish-cache/bin/varnishtest/vtc.h @@ -10,6 +10,10 @@ struct cmds { void parse_string(char *buf, const struct cmds *cmd, void *priv); -/* vtc_server.c */ +void cmd_dump(char **av, void *priv); void cmd_server(char **av, void *priv); +void cmd_client(char **av, void *priv); +void cmd_vcl(char **av, void *priv); +void cmd_stats(char **av, void *priv); +void cmd_varnish(char **av, void *priv); diff --git a/varnish-cache/bin/varnishtest/vtc_client.c b/varnish-cache/bin/varnishtest/vtc_client.c new file mode 100644 index 00000000..bc686240 --- /dev/null +++ b/varnish-cache/bin/varnishtest/vtc_client.c @@ -0,0 +1,11 @@ + +#include + +#include "vtc.h" + +void +cmd_client(char **av, void *priv) +{ + + cmd_dump(av, priv); +} diff --git a/varnish-cache/bin/varnishtest/vtc_server.c b/varnish-cache/bin/varnishtest/vtc_server.c index b2a5c46b..debfeb25 100644 --- a/varnish-cache/bin/varnishtest/vtc_server.c +++ b/varnish-cache/bin/varnishtest/vtc_server.c @@ -7,7 +7,5 @@ void cmd_server(char **av, void *priv) { - printf("cmd_server(%p)\n", priv); - while (*av) - printf("\t<%s>\n", *av++); + cmd_dump(av, priv); } diff --git a/varnish-cache/bin/varnishtest/vtc_stats.c b/varnish-cache/bin/varnishtest/vtc_stats.c new file mode 100644 index 00000000..1b68cebc --- /dev/null +++ b/varnish-cache/bin/varnishtest/vtc_stats.c @@ -0,0 +1,11 @@ + +#include + +#include "vtc.h" + +void +cmd_stats(char **av, void *priv) +{ + + cmd_dump(av, priv); +} diff --git a/varnish-cache/bin/varnishtest/vtc_varnish.c b/varnish-cache/bin/varnishtest/vtc_varnish.c new file mode 100644 index 00000000..1db6c3e7 --- /dev/null +++ b/varnish-cache/bin/varnishtest/vtc_varnish.c @@ -0,0 +1,11 @@ + +#include + +#include "vtc.h" + +void +cmd_varnish(char **av, void *priv) +{ + + cmd_dump(av, priv); +} diff --git a/varnish-cache/bin/varnishtest/vtc_vcl.c b/varnish-cache/bin/varnishtest/vtc_vcl.c new file mode 100644 index 00000000..3d6f4a36 --- /dev/null +++ b/varnish-cache/bin/varnishtest/vtc_vcl.c @@ -0,0 +1,11 @@ + +#include + +#include "vtc.h" + +void +cmd_vcl(char **av, void *priv) +{ + + cmd_dump(av, priv); +}