summaryrefslogtreecommitdiffstats
path: root/plugins/check_game.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/check_game.c')
-rw-r--r--plugins/check_game.c90
1 files changed, 42 insertions, 48 deletions
diff --git a/plugins/check_game.c b/plugins/check_game.c
index db28dfdf..811da270 100644
--- a/plugins/check_game.c
+++ b/plugins/check_game.c
@@ -19,34 +19,52 @@
19const char *progname = "check_game"; 19const char *progname = "check_game";
20const char *revision = "$Revision$"; 20const char *revision = "$Revision$";
21const char *copyright = "2002-2003"; 21const char *copyright = "2002-2003";
22const char *authors = "Nagios Plugin Development Team";
23const char *email = "nagiosplug-devel@lists.sourceforge.net"; 22const char *email = "nagiosplug-devel@lists.sourceforge.net";
24 23
25const char *summary = "\ 24#include "common.h"
26This plugin tests %s connections with the specified host.\n"; 25#include "popen.h"
26#include "utils.h"
27 27
28const char *option_summary = "\ 28void
29%s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field] [-pf ping_field]\n"; 29print_usage (void)
30{
31 printf (_("\
32Usage: %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field]\n\
33 [-pf ping_field]\n"), progname);
34 printf (_(UT_HLP_VRS), progname, progname);
35}
30 36
31const char *options = "\ 37void
38print_help (void)
39{
40 print_revision (progname, revision);
41
42 printf (_(COPYRIGHT), copyright, email);
43
44 printf (_("This plugin tests %s connections with the specified host."), progname);
45
46 print_usage ();
47
48 printf (_(UT_HELP_VRSN));
49
50 printf (_("\
32<game> = Game type that is recognised by qstat (without the leading dash)\n\ 51<game> = Game type that is recognised by qstat (without the leading dash)\n\
33<ip_address> = The IP address of the device you wish to query\n\ 52<ip_address> = The IP address of the device you wish to query\n\
34 [port] = Optional port of which to connect\n\ 53 [port] = Optional port of which to connect\n\
35 [game_field] = Field number in raw qstat output that contains game name\n\ 54 [game_field] = Field number in raw qstat output that contains game name\n\
36 [map_field] = Field number in raw qstat output that contains map name\n\ 55 [map_field] = Field number in raw qstat output that contains map name\n\
37 [ping_field] = Field number in raw qstat output that contains ping time\n\ 56 [ping_field] = Field number in raw qstat output that contains ping time\n"),
38\n\ 57 DEFAULT_SOCKET_TIMEOUT);
58
59 printf (_("\n\
39Notes:\n\ 60Notes:\n\
40- This plugin uses the 'qstat' command, the popular game server status query tool .\n\ 61- This plugin uses the 'qstat' command, the popular game server status query tool .\n\
41 If you don't have the package installed, you will need to download it from\n\ 62 If you don't have the package installed, you will need to download it from\n\
42 http://www.activesw.com/people/steve/qstat.html before you can use this plugin.\n"; 63 http://www.activesw.com/people/steve/qstat.html before you can use this plugin.\n"));
43 64
44#include "common.h" 65 printf (_(UT_SUPPORT));
45#include "popen.h" 66}
46#include "utils.h" 67
47
48void print_usage (void);
49void print_help (void);
50int process_arguments (int, char **); 68int process_arguments (int, char **);
51int validate_arguments (void); 69int validate_arguments (void);
52 70
@@ -83,11 +101,11 @@ main (int argc, char **argv)
83 result = process_arguments (argc, argv); 101 result = process_arguments (argc, argv);
84 102
85 if (result != OK) { 103 if (result != OK) {
86 printf ("Incorrect arguments supplied\n"); 104 printf (_("Incorrect arguments supplied\n"));
87 printf ("\n"); 105 printf ("\n");
88 print_revision (argv[0], "$Revision$"); 106 print_revision (progname, revision);
89 printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"); 107 printf (_("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"));
90 printf ("License: GPL\n"); 108 printf (_("License: GPL\n"));
91 printf ("\n"); 109 printf ("\n");
92 return STATE_UNKNOWN; 110 return STATE_UNKNOWN;
93 } 111 }
@@ -107,7 +125,7 @@ main (int argc, char **argv)
107 /* run the command */ 125 /* run the command */
108 fp = spopen (command_line); 126 fp = spopen (command_line);
109 if (fp == NULL) { 127 if (fp == NULL) {
110 printf ("Error - Could not open pipe: %s\n", command_line); 128 printf (_("Error - Could not open pipe: %s\n"), command_line);
111 return STATE_UNKNOWN; 129 return STATE_UNKNOWN;
112 } 130 }
113 131
@@ -127,7 +145,7 @@ main (int argc, char **argv)
127 */ 145 */
128 146
129 if (!strncmp (input_buffer, "unknown option", 14)) { 147 if (!strncmp (input_buffer, "unknown option", 14)) {
130 printf ("ERROR: Host type parameter incorrect!\n"); 148 printf (_("ERROR: Host type parameter incorrect!\n"));
131 result = STATE_CRITICAL; 149 result = STATE_CRITICAL;
132 return result; 150 return result;
133 } 151 }
@@ -217,7 +235,7 @@ process_arguments (int argc, char **argv)
217 235
218 switch (c) { 236 switch (c) {
219 case '?': /* args not parsable */ 237 case '?': /* args not parsable */
220 printf ("%s: Unknown argument: %s\n\n", progname, optarg); 238 printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
221 print_usage (); 239 print_usage ();
222 exit (STATE_UNKNOWN); 240 exit (STATE_UNKNOWN);
223 case 'h': /* help */ 241 case 'h': /* help */
@@ -234,7 +252,7 @@ process_arguments (int argc, char **argv)
234 break; 252 break;
235 case 'H': /* hostname */ 253 case 'H': /* hostname */
236 if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH) 254 if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH)
237 terminate (STATE_UNKNOWN, "Input buffer overflow\n"); 255 terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
238 server_ip = strdup (optarg); 256 server_ip = strdup (optarg);
239 break; 257 break;
240 case 'P': /* port */ 258 case 'P': /* port */
@@ -242,7 +260,7 @@ process_arguments (int argc, char **argv)
242 break; 260 break;
243 case 'G': /* hostname */ 261 case 'G': /* hostname */
244 if (strlen (optarg) >= MAX_INPUT_BUFFER) 262 if (strlen (optarg) >= MAX_INPUT_BUFFER)
245 terminate (STATE_UNKNOWN, "Input buffer overflow\n"); 263 terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
246 game_type = strdup (optarg); 264 game_type = strdup (optarg);
247 break; 265 break;
248 case 'p': /* index of ping field */ 266 case 'p': /* index of ping field */
@@ -290,27 +308,3 @@ validate_arguments (void)
290{ 308{
291 return OK; 309 return OK;
292} 310}
293
294
295void
296print_help (void)
297{
298 print_revision (progname, revision);
299 printf ("Copyright (c) %s %s\n\t<%s>\n\n",
300 copyright, authors, email);
301 printf (summary, progname);
302 print_usage ();
303 printf ("\nOptions:\n");
304 printf (options, DEFAULT_SOCKET_TIMEOUT);
305 support ();
306}
307
308void
309print_usage (void)
310{
311 printf
312 ("Usage: %s %s\n"
313 " %s (-h|--help)\n"
314 " %s (-V|--version)\n", progname, option_summary, progname, progname);
315}
316