From 61a02c69425e5a456d41d3ea2bd69402660c337f Mon Sep 17 00:00:00 2001 From: phk Date: Tue, 24 Jun 2008 10:35:15 +0000 Subject: [PATCH] Add a "shell" keyword for executing shell commands with system(3). git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2787 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- varnish-cache/bin/varnishtest/vtc.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/varnish-cache/bin/varnishtest/vtc.c b/varnish-cache/bin/varnishtest/vtc.c index 0f314f17..7b27e5d1 100644 --- a/varnish-cache/bin/varnishtest/vtc.c +++ b/varnish-cache/bin/varnishtest/vtc.c @@ -42,6 +42,8 @@ #define MAX_FILESIZE (1024 * 1024) #define MAX_TOKENS 100 +static struct vtclog *vl; + /********************************************************************** * Read a file into memory */ @@ -207,6 +209,22 @@ cmd_test(CMD_ARGS) AZ(av[2]); } +/********************************************************************** + * Shell command execution + */ + +static void +cmd_shell(CMD_ARGS) +{ + + (void)priv; + (void)cmd; + + AN(av[1]); + AZ(av[2]); + vtc_dump(vl, 4, "shell", av[1]); + system(av[1]); +} /********************************************************************** * Dump command arguments @@ -258,6 +276,7 @@ static struct cmds cmds[] = { { "varnish", cmd_varnish }, { "delay", cmd_delay }, { "test", cmd_test }, + { "shell", cmd_shell }, { NULL, NULL } }; @@ -285,6 +304,8 @@ main(int argc, char **argv) setbuf(stdout, NULL); setbuf(stderr, NULL); + vl = vtc_logopen(""); + AN(vl); while ((ch = getopt(argc, argv, "qv")) != -1) { switch (ch) { case 'q': -- 2.39.5