[master] bcfc82e Polish error messages a bit.

Poul-Henning Kamp phk at FreeBSD.org
Thu Dec 22 23:17:05 CET 2016


commit bcfc82eb29bf48fe1160f41c999fb299fa36cb11
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Dec 22 20:55:52 2016 +0000

    Polish error messages a bit.

diff --git a/bin/varnishd/mgt/mgt_main.c b/bin/varnishd/mgt/mgt_main.c
index 1feef09..95bc834 100644
--- a/bin/varnishd/mgt/mgt_main.c
+++ b/bin/varnishd/mgt/mgt_main.c
@@ -589,17 +589,26 @@ main(int argc, char * const *argv)
 
 	if (x_arg != NULL) {
 		if (argc != 3)
-			ARGV_ERR("-x is incompatible all options/arguments\n");
+			ARGV_ERR("-x is incompatible with everything else\n");
 		mgt_x_arg(x_arg);
 		exit(0);
 	}
 
+	if (b_arg != NULL && f_arg != NULL)
+		ARGV_ERR("Only one of -b or -f can be specified\n");
+
 	if (d_flag && F_flag)
 		ARGV_ERR("Only one of -d or -F can be specified\n");
+
 	if (C_flag && b_arg == NULL && f_arg == NULL)
-		ARGV_ERR("-C only good with -b or -f\n");
-	if (b_arg != NULL && f_arg != NULL)
-		ARGV_ERR("Only one of -b or -f can be specified\n");
+		ARGV_ERR("-C needs either -b <backend> or -f <vcl_file>\n");
+
+	if (d_flag && C_flag)
+		ARGV_ERR("-d makes no sense with -C\n");
+
+	if (F_flag && C_flag)
+		ARGV_ERR("-F makes no sense with -C\n");
+
 
 	/* Set up the mgt counters */
 	memset(&static_VSC_C_mgt, 0, sizeof static_VSC_C_mgt);
diff --git a/bin/varnishtest/tests/a00009.vtc b/bin/varnishtest/tests/a00009.vtc
index 582bb63..40b0be6 100644
--- a/bin/varnishtest/tests/a00009.vtc
+++ b/bin/varnishtest/tests/a00009.vtc
@@ -8,9 +8,11 @@ err_shell {VCL version declaration missing} "echo 'bad vcl' >${tmpdir}/t.vcl ; v
 err_shell {VCL version declaration missing} "echo 'bad vcl' >${tmpdir}/t.vcl ; varnishd -C -f ${tmpdir}/t.vcl -n ${tmpdir} 2>&1"
 err_shell {-spersistent has been deprecated} "varnishd -spersistent 2>&1"
 err_shell {Unknown jail method "xyz"} "varnishd -jxyz 2>&1"
-err_shell {-x is incompatible all options/arguments} "varnishd -d -x foo 2>&1"
+err_shell {-x is incompatible with everything else} "varnishd -d -x foo 2>&1"
 err_shell {Invalid -x argument} "varnishd -x foo 2>&1"
 err_shell {Too many arguments} "varnishd foo 2>&1"
 err_shell {Only one of -d or -F can be specified} "varnishd -d -F 2>&1"
 err_shell {Only one of -b or -f can be specified} "varnishd -b a -f b 2>&1"
-err_shell {-C only good with -b or -f} "varnishd -C 2>&1"
+err_shell {-C needs either -b <backend> or -f <vcl_file>} "varnishd -C 2>&1"
+err_shell {-d makes no sense with -C} "varnishd -C -b 127.0.0.1:80 -d 2>&1"
+err_shell {-F makes no sense with -C} "varnishd -C -b 127.0.0.1:80 -F 2>&1"



More information about the varnish-commit mailing list