Code

Added argc checks before attempting to access argv[]
[nagiosplug.git] / plugins / check_game.c
index 63d1be628e2122c6b7de9a27ba7816f72b166123..8cf1bf4290ab9e469dc1152150afef5ba73184e2 100644 (file)
@@ -69,6 +69,7 @@
 #include "utils.h"
 
 int process_arguments (int, char **);
+const char *progname = "check_game";
 
 #define QSTAT_DATA_DELIMITER   ","
 
@@ -81,6 +82,8 @@ char server_ip[MAX_HOST_ADDRESS_LENGTH];
 char game_type[MAX_INPUT_BUFFER];
 char port[MAX_INPUT_BUFFER];
 
+int qstat_game_players_max = 4;
+int qstat_game_players = 5;
 int qstat_game_field = 2;
 int qstat_map_field = 3;
 int qstat_ping_field = 5;
@@ -199,8 +202,12 @@ main (int argc, char **argv)
                result = STATE_CRITICAL;
        }
        else {
-               printf ("OK: %s (%s), Ping: %s ms\n", ret[qstat_game_field],
-                                               ret[qstat_map_field], ret[qstat_ping_field]);
+               printf ("OK: %s/%s %s (%s), Ping: %s ms\n", 
+               ret[qstat_game_players_max],
+               ret[qstat_game_players],
+                ret[qstat_game_field], 
+               ret[qstat_map_field],
+               ret[qstat_ping_field]);
        }
 
        /* close the pipe */
@@ -285,3 +292,8 @@ process_arguments (int argc, char **argv)
 
        return OK;
 }
+
+void print_usage (void)
+{
+       return STATE_OK;
+}