Commit c6e3bffb authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Add a "shell" keyword for executing shell commands with system(3).



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@2787 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent 41a07bd2
......@@ -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':
......
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