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
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
......
......@@ -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 }
};
......
......@@ -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);
#include <stdio.h>
#include "vtc.h"
void
cmd_client(char **av, void *priv)
{
cmd_dump(av, priv);
}
......@@ -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);
}
#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