/**********************************************************************
- * Execute a file
+ * Dump command arguments
+ */
+
+void
+cmd_delay(char **av, void *priv)
+{
+ double f;
+
+ (void)priv;
+ if (av == NULL)
+ return;
+ AN(av[1]);
+ AZ(av[2]);
+ f = strtod(av[1], NULL);
+ if (f > 100.) {
+ sleep((int)f);
+ } else {
+ usleep((int)(f * 1e6));
+ }
+}
+
+/**********************************************************************
+ * Dump command arguments
*/
void
printf("\t<%s>\n", *av++);
}
+/**********************************************************************
+ * Execute a file
+ */
+
static struct cmds cmds[] = {
{ "server", cmd_server },
{ "client", cmd_client },
{ "stats", cmd_stats },
{ "varnish", cmd_varnish },
+ { "delay", cmd_delay },
{ "test", cmd_test },
{ NULL, NULL }
};
int ch;
setbuf(stdout, NULL);
+ setbuf(stderr, NULL);
while ((ch = getopt(argc, argv, "")) != -1) {
switch (ch) {
case '?':
void parse_string(char *buf, const struct cmds *cmd, void *priv);
void cmd_dump(char **av, void *priv);
+void cmd_delay(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);