]> err.no Git - varnish/commitdiff
If CLI is NULL, use stdout.
authorphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 23 Aug 2006 06:53:28 +0000 (06:53 +0000)
committerphk <phk@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 23 Aug 2006 06:53:28 +0000 (06:53 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@898 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-cache/lib/libvarnish/cli_common.c

index 65a3b00e0e986bd79bfa53d30a0b32620950c711..a4672c51cd48fa1ae8c7321c9d7ef3cb9afe231d 100644 (file)
@@ -29,23 +29,30 @@ cli_out(struct cli *cli, const char *fmt, ...)
        va_list ap;
 
        va_start(ap, fmt);
-       vsb_vprintf(cli->sb, fmt, ap);
+       if (cli != NULL)
+               vsb_vprintf(cli->sb, fmt, ap);
+       else
+               vfprintf(stdout, fmt, ap);
        va_end(ap);
 }
 
 void
-cli_param(struct cli *cli)
+cli_result(struct cli *cli, unsigned res)
 {
 
-       cli->result = CLIS_PARAM;
-       cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n");
+       if (cli != NULL)
+               cli->result = res;
+       else
+               printf("CLI result = %d\n", res);
 }
 
+
 void
-cli_result(struct cli *cli, unsigned res)
+cli_param(struct cli *cli)
 {
 
-       cli->result = res;
+       cli_result(cli, CLIS_PARAM);
+       cli_out(cli, "Parameter error, use \"help [command]\" for more info.\n");
 }
 
 int