r898 - trunk/varnish-cache/lib/libvarnish

phk at projects.linpro.no phk at projects.linpro.no
Wed Aug 23 08:53:28 CEST 2006


Author: phk
Date: 2006-08-23 08:53:28 +0200 (Wed, 23 Aug 2006)
New Revision: 898

Modified:
   trunk/varnish-cache/lib/libvarnish/cli_common.c
Log:
If CLI is NULL, use stdout.


Modified: trunk/varnish-cache/lib/libvarnish/cli_common.c
===================================================================
--- trunk/varnish-cache/lib/libvarnish/cli_common.c	2006-08-22 19:14:01 UTC (rev 897)
+++ trunk/varnish-cache/lib/libvarnish/cli_common.c	2006-08-23 06:53:28 UTC (rev 898)
@@ -29,23 +29,30 @@
 	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




More information about the varnish-commit mailing list