]> err.no Git - varnish/commitdiff
Style fixes
authordes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 25 Jul 2007 11:04:50 +0000 (11:04 +0000)
committerdes <des@d4fa192b-c00b-0410-8231-f00ffab90ce4>
Wed, 25 Jul 2007 11:04:50 +0000 (11:04 +0000)
git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@1763 d4fa192b-c00b-0410-8231-f00ffab90ce4

varnish-tools/nagios/check_varnish.c

index 7f9ae7369b6d5e308f4352a3ca8b788796d46e22..cbb26261dd0cb350bd79e238b82e28aac06bce47 100644 (file)
@@ -92,8 +92,8 @@ check_stats(struct varnish_stats *VSL_stats, char *param, int w, int c, int less
 {
        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 @@ check_stats(struct varnish_stats *VSL_stats, char *param, int w, int c, int less
                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 @@ check_stats(struct varnish_stats *VSL_stats, char *param, int w, int c, int less
 static void
 help(void)
 {
+
        fprintf(stderr, "usage: "
            "check_varnish [-l] [-n varnish_name] [-p param_name [-c N] [-w N]]\n"
            "\n"