r1763 - trunk/varnish-tools/nagios

des at projects.linpro.no des at projects.linpro.no
Wed Jul 25 13:04:50 CEST 2007


Author: des
Date: 2007-07-25 13:04:50 +0200 (Wed, 25 Jul 2007)
New Revision: 1763

Modified:
   trunk/varnish-tools/nagios/check_varnish.c
Log:
Style fixes


Modified: trunk/varnish-tools/nagios/check_varnish.c
===================================================================
--- trunk/varnish-tools/nagios/check_varnish.c	2007-07-25 08:53:16 UTC (rev 1762)
+++ trunk/varnish-tools/nagios/check_varnish.c	2007-07-25 11:04:50 UTC (rev 1763)
@@ -92,8 +92,8 @@
 {
 	int level;
 
-	if (!strcmp(param, "ratio")) {
-		int64_t total = VSL_stats->cache_hit + VSL_stats->cache_miss;
+	if (strcmp(param, "ratio") == 0) {
+		intmax_t total = VSL_stats->cache_hit + VSL_stats->cache_miss;
 		double ratio = 0;
 
 		if (total > 0)
@@ -102,16 +102,15 @@
 		message_and_exit(level, ratio, "Cache hit ratio");
 	}
 #define MAC_STAT(n, t, f, d) \
-	do { \
-		intmax_t ju = VSL_stats->n; \
-		if (!strcmp(param, #n)) { \
-			level = check_treshold(ju, w, c, less); \
-			message_and_exit(level, ju, d); \
-		} \
-	} while (0);
+	else if (strcmp(param, #n) == 0) { \
+		intmax_t val = VSL_stats->n; \
+		level = check_treshold(val, w, c, less); \
+		message_and_exit(level, val, d); \
+	}
 #include "stat_field.h"
 #undef MAC_STAT
-	printf("Invalid parameter: %s\n", param);
+	else
+		printf("Unknown parameter '%s'\n", param);
 	exit(3);
 }
 
@@ -120,6 +119,7 @@
 static void
 help(void)
 {
+
 	fprintf(stderr, "usage: "
 	    "check_varnish [-l] [-n varnish_name] [-p param_name [-c N] [-w N]]\n"
 	    "\n"




More information about the varnish-commit mailing list