Commit 091d13d5 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Hash out more files and cmd functions



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2667 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent c2f51aa7
...@@ -2,6 +2,10 @@ PROG = vtc ...@@ -2,6 +2,10 @@ PROG = vtc
SRCS += vtc.c SRCS += vtc.c
SRCS += vtc_server.c SRCS += vtc_server.c
SRCS += vtc_client.c
SRCS += vtc_vcl.c
SRCS += vtc_stats.c
SRCS += vtc_varnish.c
CFLAGS += -g CFLAGS += -g
......
...@@ -76,7 +76,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) ...@@ -76,7 +76,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv)
p++; p++;
} else if (*p == '{') { /* Braces */ } else if (*p == '{') { /* Braces */
nest_brace = 0; nest_brace = 0;
token_s[tn] = p + 1; token_s[tn] = p;
for (; *p != '\0'; p++) { for (; *p != '\0'; p++) {
if (*p == '{') if (*p == '{')
nest_brace++; nest_brace++;
...@@ -86,8 +86,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) ...@@ -86,8 +86,7 @@ parse_string(char *buf, const struct cmds *cmd, void *priv)
} }
} }
assert(*p == '}'); assert(*p == '}');
token_e[tn++] = p; token_e[tn++] = ++p;
p++; /* Swallow closing brace */
} else { /* other tokens */ } else { /* other tokens */
token_s[tn] = p; token_s[tn] = p;
for (; *p != '\0' && !isspace(*p); p++) for (; *p != '\0' && !isspace(*p); p++)
...@@ -119,20 +118,21 @@ parse_string(char *buf, const struct cmds *cmd, void *priv) ...@@ -119,20 +118,21 @@ parse_string(char *buf, const struct cmds *cmd, void *priv)
* Execute a file * Execute a file
*/ */
static void void
cmd_bogo(char **av, void *priv) cmd_dump(char **av, void *priv)
{ {
printf("cmd_bogo(%p)\n", priv);
printf("cmd_dump(%p)\n", priv);
while (*av) while (*av)
printf("\t<%s>\n", *av++); printf("\t<%s>\n", *av++);
} }
static struct cmds cmds[] = { static struct cmds cmds[] = {
{ "server", cmd_server }, { "server", cmd_server },
{ "client", cmd_bogo }, { "client", cmd_client },
{ "vcl", cmd_bogo }, { "vcl", cmd_vcl },
{ "stats", cmd_bogo }, { "stats", cmd_stats },
{ "varnish", cmd_bogo }, { "varnish", cmd_varnish },
{ NULL, NULL } { NULL, NULL }
}; };
......
...@@ -10,6 +10,10 @@ struct cmds { ...@@ -10,6 +10,10 @@ struct cmds {
void parse_string(char *buf, const struct cmds *cmd, void *priv); 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_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);
#include <stdio.h>
#include "vtc.h"
void
cmd_client(char **av, void *priv)
{
cmd_dump(av, priv);
}
...@@ -7,7 +7,5 @@ void ...@@ -7,7 +7,5 @@ void
cmd_server(char **av, void *priv) cmd_server(char **av, void *priv)
{ {
printf("cmd_server(%p)\n", priv); cmd_dump(av, priv);
while (*av)
printf("\t<%s>\n", *av++);
} }
#include <stdio.h>
#include "vtc.h"
void
cmd_stats(char **av, void *priv)
{
cmd_dump(av, priv);
}
#include <stdio.h>
#include "vtc.h"
void
cmd_varnish(char **av, void *priv)
{
cmd_dump(av, priv);
}
#include <stdio.h>
#include "vtc.h"
void
cmd_vcl(char **av, void *priv)
{
cmd_dump(av, priv);
}
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