]> err.no Git - varnish/commitdiff
Add a "shell" keyword for executing shell commands with system(3).
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 24 Jun 2008 10:35:15 +0000 (10:35 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Tue, 24 Jun 2008 10:35:15 +0000 (10:35 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@2787 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/bin/varnishtest/vtc.c

index 0f314f17edbdbc7c18af29d1d85deca164307ab9..7b27e5d1799b7dedb9938c6d01c77c7e8b0ce213 100644 (file)
@@ -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':