r2787 - trunk/varnish-cache/bin/varnishtest
phk at projects.linpro.no
phk at projects.linpro.no
Tue Jun 24 12:35:15 CEST 2008
Author: phk
Date: 2008-06-24 12:35:15 +0200 (Tue, 24 Jun 2008)
New Revision: 2787
Modified:
trunk/varnish-cache/bin/varnishtest/vtc.c
Log:
Add a "shell" keyword for executing shell commands with system(3).
Modified: trunk/varnish-cache/bin/varnishtest/vtc.c
===================================================================
--- trunk/varnish-cache/bin/varnishtest/vtc.c 2008-06-24 10:15:17 UTC (rev 2786)
+++ trunk/varnish-cache/bin/varnishtest/vtc.c 2008-06-24 10:35:15 UTC (rev 2787)
@@ -42,6 +42,8 @@
#define MAX_FILESIZE (1024 * 1024)
#define MAX_TOKENS 100
+static struct vtclog *vl;
+
/**********************************************************************
* Read a file into memory
*/
@@ -207,7 +209,23 @@
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 @@
{ "varnish", cmd_varnish },
{ "delay", cmd_delay },
{ "test", cmd_test },
+ { "shell", cmd_shell },
{ NULL, NULL }
};
@@ -285,6 +304,8 @@
setbuf(stdout, NULL);
setbuf(stderr, NULL);
+ vl = vtc_logopen("");
+ AN(vl);
while ((ch = getopt(argc, argv, "qv")) != -1) {
switch (ch) {
case 'q':
More information about the varnish-commit
mailing list