From: phk Date: Wed, 23 Aug 2006 06:53:28 +0000 (+0000) Subject: If CLI is NULL, use stdout. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e1e7e3820281ca0d246184412f237329eaddcbc1;p=varnish If CLI is NULL, use stdout. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@898 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/lib/libvarnish/cli_common.c b/varnish-cache/lib/libvarnish/cli_common.c index 65a3b00e..a4672c51 100644 --- a/varnish-cache/lib/libvarnish/cli_common.c +++ b/varnish-cache/lib/libvarnish/cli_common.c @@ -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