Просмотр исходного кода

markupf for translation

git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@634 f882894a-f735-0410-b71e-b25c423dba1c
Karl DeBisschop 22 лет назад
Родитель
Сommit
561da286a1
5 измененных файлов с 137 добавлено и 149 удалено
  1. 18 18
      plugins/check_fping.c
  2. 42 48
      plugins/check_game.c
  3. 51 57
      plugins/check_mysql.c
  4. 22 26
      plugins/check_snmp.c
  5. 4 0
      plugins/utils.h

+ 18 - 18
plugins/check_fping.c

@@ -88,7 +88,7 @@ time (ms) which triggers a WARNING or CRITICAL state, and <pl> is the\n\
 percentage of packet loss to trigger an alarm state.\n"));
 percentage of packet loss to trigger an alarm state.\n"));
 
 
 }
 }
-
+
 int textscan (char *buf);
 int textscan (char *buf);
 int process_arguments (int, char **);
 int process_arguments (int, char **);
 int get_threshold (char *arg, char *rv[2]);
 int get_threshold (char *arg, char *rv[2]);
@@ -112,7 +112,7 @@ main (int argc, char **argv)
 	input_buffer = malloc (MAX_INPUT_BUFFER);
 	input_buffer = malloc (MAX_INPUT_BUFFER);
 
 
 	if (process_arguments (argc, argv) == ERROR)
 	if (process_arguments (argc, argv) == ERROR)
-		usage ("Could not parse arguments\n");
+		usage (_("Could not parse arguments\n"));
 
 
 	server = strscpy (server, server_name);
 	server = strscpy (server, server_name);
 
 
@@ -126,13 +126,13 @@ main (int argc, char **argv)
 	/* run the command */
 	/* run the command */
 	child_process = spopen (command_line);
 	child_process = spopen (command_line);
 	if (child_process == NULL) {
 	if (child_process == NULL) {
-		printf ("Unable to open pipe: %s\n", command_line);
+		printf (_("Unable to open pipe: %s\n"), command_line);
 		return STATE_UNKNOWN;
 		return STATE_UNKNOWN;
 	}
 	}
 
 
 	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
 	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
 	if (child_stderr == NULL) {
 	if (child_stderr == NULL) {
-		printf ("Could not open stderr for %s\n", command_line);
+		printf (_("Could not open stderr for %s\n"), command_line);
 	}
 	}
 
 
 	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
 	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process)) {
@@ -173,16 +173,16 @@ textscan (char *buf)
 	int status = STATE_UNKNOWN;
 	int status = STATE_UNKNOWN;
 
 
 	if (strstr (buf, "not found")) {
 	if (strstr (buf, "not found")) {
-		terminate (STATE_CRITICAL, "FPING unknown - %s not found\n", server_name);
+		terminate (STATE_CRITICAL, _("FPING unknown - %s not found\n"), server_name);
 
 
 	}
 	}
 	else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
 	else if (strstr (buf, "is unreachable") || strstr (buf, "Unreachable")) {
-		terminate (STATE_CRITICAL, "FPING critical - %s is unreachable\n",
+		terminate (STATE_CRITICAL, _("FPING critical - %s is unreachable\n"),
 							 "host");
 							 "host");
 
 
 	}
 	}
 	else if (strstr (buf, "is down")) {
 	else if (strstr (buf, "is down")) {
-		terminate (STATE_CRITICAL, "FPING critical - %s is down\n", server_name);
+		terminate (STATE_CRITICAL, _("FPING critical - %s is down\n"), server_name);
 
 
 	}
 	}
 	else if (strstr (buf, "is alive")) {
 	else if (strstr (buf, "is alive")) {
@@ -208,7 +208,7 @@ textscan (char *buf)
 			status = STATE_WARNING;
 			status = STATE_WARNING;
 		else
 		else
 			status = STATE_OK;
 			status = STATE_OK;
-		terminate (status, "FPING %s - %s (loss=%f%%, rta=%f ms)\n",
+		terminate (status, _("FPING %s - %s (loss=%f%%, rta=%f ms)\n"),
 							 state_text (status), server_name, loss, rta);
 							 state_text (status), server_name, loss, rta);
 
 
 	}
 	}
@@ -227,7 +227,7 @@ textscan (char *buf)
 		else
 		else
 			status = STATE_OK;
 			status = STATE_OK;
 		
 		
-		terminate (status, "FPING %s - %s (loss=%f%% )\n",
+		terminate (status, _("FPING %s - %s (loss=%f%% )\n"),
 							 state_text (status), server_name, loss );		
 							 state_text (status), server_name, loss );		
 	
 	
 	}
 	}
@@ -237,7 +237,7 @@ textscan (char *buf)
 
 
 	return status;
 	return status;
 }
 }
-
+
 
 
 
 
 
 
@@ -282,21 +282,21 @@ process_arguments (int argc, char **argv)
 
 
 		switch (c) {
 		switch (c) {
 		case '?':									/* print short usage statement if args not parsable */
 		case '?':									/* print short usage statement if args not parsable */
-			printf ("%s: Unknown argument: %s\n\n", progname, optarg);
+			printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
 			print_usage ();
 			print_usage ();
 			exit (STATE_UNKNOWN);
 			exit (STATE_UNKNOWN);
 		case 'h':									/* help */
 		case 'h':									/* help */
 			print_help ();
 			print_help ();
 			exit (STATE_OK);
 			exit (STATE_OK);
 		case 'V':									/* version */
 		case 'V':									/* version */
-			print_revision (progname, "$Revision$");
+			print_revision (progname, revision);
 			exit (STATE_OK);
 			exit (STATE_OK);
 		case 'v':									/* verbose mode */
 		case 'v':									/* verbose mode */
 			verbose = TRUE;
 			verbose = TRUE;
 			break;
 			break;
 		case 'H':									/* hostname */
 		case 'H':									/* hostname */
 			if (is_host (optarg) == FALSE) {
 			if (is_host (optarg) == FALSE) {
-				printf ("Invalid host name/address\n\n");
+				printf (_("Invalid host name/address\n\n"));
 				print_usage ();
 				print_usage ();
 				exit (STATE_UNKNOWN);
 				exit (STATE_UNKNOWN);
 			}
 			}
@@ -328,20 +328,20 @@ process_arguments (int argc, char **argv)
 			if (is_intpos (optarg))
 			if (is_intpos (optarg))
 				packet_size = atoi (optarg);
 				packet_size = atoi (optarg);
 			else
 			else
-				usage ("Packet size must be a positive integer");
+				usage (_("Packet size must be a positive integer"));
 			break;
 			break;
 		case 'n':									/* number of packets */
 		case 'n':									/* number of packets */
 			if (is_intpos (optarg))
 			if (is_intpos (optarg))
 				packet_count = atoi (optarg);
 				packet_count = atoi (optarg);
 			else
 			else
-				usage ("Packet count must be a positive integer");
+				usage (_("Packet count must be a positive integer"));
 			break;
 			break;
 		}
 		}
 	}
 	}
 
 
 
 
 	if (server_name == NULL)
 	if (server_name == NULL)
-		usage ("Host name was not supplied\n\n");
+		usage (_("Host name was not supplied\n\n"));
 
 
 	return OK;
 	return OK;
 }
 }
@@ -364,11 +364,11 @@ get_threshold (char *arg, char *rv[2])
 		arg1[strcspn (arg1, ",:")] = 0;
 		arg1[strcspn (arg1, ",:")] = 0;
 		if (strstr (arg1, "%") && strstr (arg2, "%"))
 		if (strstr (arg1, "%") && strstr (arg2, "%"))
 			terminate (STATE_UNKNOWN,
 			terminate (STATE_UNKNOWN,
-								 "%s: Only one threshold may be packet loss (%s)\n", progname,
+								 _("%s: Only one threshold may be packet loss (%s)\n"), progname,
 								 arg);
 								 arg);
 		if (!strstr (arg1, "%") && !strstr (arg2, "%"))
 		if (!strstr (arg1, "%") && !strstr (arg2, "%"))
 			terminate (STATE_UNKNOWN,
 			terminate (STATE_UNKNOWN,
-								 "%s: Only one threshold must be packet loss (%s)\n",
+								 _("%s: Only one threshold must be packet loss (%s)\n"),
 								 progname, arg);
 								 progname, arg);
 	}
 	}
 
 

+ 42 - 48
plugins/check_game.c

@@ -19,34 +19,52 @@
 const char *progname = "check_game";
 const char *progname = "check_game";
 const char *revision = "$Revision$";
 const char *revision = "$Revision$";
 const char *copyright = "2002-2003";
 const char *copyright = "2002-2003";
-const char *authors = "Nagios Plugin Development Team";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
 
-const char *summary = "\
-This plugin tests %s connections with the specified host.\n";
+#include "common.h"
+#include "popen.h"
+#include "utils.h"
 
 
-const char *option_summary = "\
-%s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field] [-pf ping_field]\n";
+void
+print_usage (void)
+{
+	printf (_("\
+Usage: %s <game> <ip_address> [-p port] [-gf game_field] [-mf map_field]\n\
+  [-pf ping_field]\n"), progname);
+	printf (_(UT_HLP_VRS), progname, progname);
+}
 
 
-const char *options = "\
+void
+print_help (void)
+{
+	print_revision (progname, revision);
+
+	printf (_(COPYRIGHT), copyright, email);
+
+	printf (_("This plugin tests %s connections with the specified host."), progname);
+
+	print_usage ();
+
+	printf (_(UT_HELP_VRSN));
+
+	printf (_("\
 <game>        = Game type that is recognised by qstat (without the leading dash)\n\
 <game>        = Game type that is recognised by qstat (without the leading dash)\n\
 <ip_address>  = The IP address of the device you wish to query\n\
 <ip_address>  = The IP address of the device you wish to query\n\
  [port]        = Optional port of which to connect\n\
  [port]        = Optional port of which to connect\n\
  [game_field]  = Field number in raw qstat output that contains game name\n\
  [game_field]  = Field number in raw qstat output that contains game name\n\
  [map_field]   = Field number in raw qstat output that contains map name\n\
  [map_field]   = Field number in raw qstat output that contains map name\n\
- [ping_field]  = Field number in raw qstat output that contains ping time\n\
-\n\
+ [ping_field]  = Field number in raw qstat output that contains ping time\n"),
+	        DEFAULT_SOCKET_TIMEOUT);
+
+	printf (_("\n\
 Notes:\n\
 Notes:\n\
 - This plugin uses the 'qstat' command, the popular game server status query tool .\n\
 - This plugin uses the 'qstat' command, the popular game server status query tool .\n\
   If you don't have the package installed, you will need to download it from\n\
   If you don't have the package installed, you will need to download it from\n\
-  http://www.activesw.com/people/steve/qstat.html before you can use this plugin.\n";
+  http://www.activesw.com/people/steve/qstat.html before you can use this plugin.\n"));
 
 
-#include "common.h"
-#include "popen.h"
-#include "utils.h"
-
-void print_usage (void);
-void print_help (void);
+	printf (_(UT_SUPPORT));
+}
+
 int process_arguments (int, char **);
 int process_arguments (int, char **);
 int validate_arguments (void);
 int validate_arguments (void);
 
 
@@ -83,11 +101,11 @@ main (int argc, char **argv)
 	result = process_arguments (argc, argv);
 	result = process_arguments (argc, argv);
 
 
 	if (result != OK) {
 	if (result != OK) {
-		printf ("Incorrect arguments supplied\n");
+		printf (_("Incorrect arguments supplied\n"));
 		printf ("\n");
 		printf ("\n");
-		print_revision (argv[0], "$Revision$");
-		printf ("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n");
-		printf ("License: GPL\n");
+		print_revision (progname, revision);
+		printf (_("Copyright (c) 1999 Ian Cass, Knowledge Matters Limited\n"));
+		printf (_("License: GPL\n"));
 		printf ("\n");
 		printf ("\n");
 		return STATE_UNKNOWN;
 		return STATE_UNKNOWN;
 	}
 	}
@@ -107,7 +125,7 @@ main (int argc, char **argv)
 	/* run the command */
 	/* run the command */
 	fp = spopen (command_line);
 	fp = spopen (command_line);
 	if (fp == NULL) {
 	if (fp == NULL) {
-		printf ("Error - Could not open pipe: %s\n", command_line);
+		printf (_("Error - Could not open pipe: %s\n"), command_line);
 		return STATE_UNKNOWN;
 		return STATE_UNKNOWN;
 	}
 	}
 
 
@@ -127,7 +145,7 @@ main (int argc, char **argv)
 	 */
 	 */
 
 
 	if (!strncmp (input_buffer, "unknown option", 14)) {
 	if (!strncmp (input_buffer, "unknown option", 14)) {
-		printf ("ERROR: Host type parameter incorrect!\n");
+		printf (_("ERROR: Host type parameter incorrect!\n"));
 		result = STATE_CRITICAL;
 		result = STATE_CRITICAL;
 		return result;
 		return result;
 	}
 	}
@@ -217,7 +235,7 @@ process_arguments (int argc, char **argv)
 
 
 		switch (c) {
 		switch (c) {
 		case '?': /* args not parsable */
 		case '?': /* args not parsable */
-			printf ("%s: Unknown argument: %s\n\n", progname, optarg);
+			printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
 			print_usage ();
 			print_usage ();
 			exit (STATE_UNKNOWN);
 			exit (STATE_UNKNOWN);
 		case 'h': /* help */
 		case 'h': /* help */
@@ -234,7 +252,7 @@ process_arguments (int argc, char **argv)
 			break;
 			break;
 		case 'H': /* hostname */
 		case 'H': /* hostname */
 			if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH)
 			if (strlen (optarg) >= MAX_HOST_ADDRESS_LENGTH)
-				terminate (STATE_UNKNOWN, "Input buffer overflow\n");
+				terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
 			server_ip = strdup (optarg);
 			server_ip = strdup (optarg);
 			break;
 			break;
 		case 'P': /* port */
 		case 'P': /* port */
@@ -242,7 +260,7 @@ process_arguments (int argc, char **argv)
 			break;
 			break;
 		case 'G': /* hostname */
 		case 'G': /* hostname */
 			if (strlen (optarg) >= MAX_INPUT_BUFFER)
 			if (strlen (optarg) >= MAX_INPUT_BUFFER)
-				terminate (STATE_UNKNOWN, "Input buffer overflow\n");
+				terminate (STATE_UNKNOWN, _("Input buffer overflow\n"));
 			game_type = strdup (optarg);
 			game_type = strdup (optarg);
 			break;
 			break;
 		case 'p': /* index of ping field */
 		case 'p': /* index of ping field */
@@ -290,27 +308,3 @@ validate_arguments (void)
 {
 {
 		return OK;
 		return OK;
 }
 }
-
-
-void
-print_help (void)
-{
-        print_revision (progname, revision);
-        printf ("Copyright (c) %s %s\n\t<%s>\n\n",
-                 copyright, authors, email);
-	printf (summary, progname);
-        print_usage ();
-        printf ("\nOptions:\n");
-        printf (options, DEFAULT_SOCKET_TIMEOUT);
-        support ();
-}
-
-void
-print_usage (void)
-{
-        printf
-                ("Usage: %s %s\n"
-                 "       %s (-h|--help)\n"
-                 "       %s (-V|--version)\n", progname, option_summary, progname, progname);
-}
-

+ 51 - 57
plugins/check_mysql.c

@@ -15,25 +15,66 @@
 ******************************************************************************/
 ******************************************************************************/
 
 
 const char *progname = "check_mysql";
 const char *progname = "check_mysql";
-#define REVISION "$Revision$"
-#define COPYRIGHT "1999-2002"
+const char *revision = "$Revision$";
+const char *copyright = "1999-2002";
+const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
 
 #include "common.h"
 #include "common.h"
 #include "utils.h"
 #include "utils.h"
-
+#include "netutils.h"
 #include <mysql/mysql.h>
 #include <mysql/mysql.h>
 #include <mysql/errmsg.h>
 #include <mysql/errmsg.h>
 
 
+unsigned int db_port = MYSQL_PORT;
+
+void
+print_usage (void)
+{
+	printf (_("\
+Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"),
+	        progname);
+	printf (_(UT_HLP_VRS), progname, progname);
+}
+
+void
+print_help (void)
+{
+	print_revision (progname, revision);
+
+	printf (_(COPYRIGHT), copyright, email);
+
+	printf (_("This program tests connections to a mysql server\n"));
+
+	print_usage ();
+
+	printf (_(UT_HELP_VRSN));
+
+	printf (_(UT_HOST_PORT), 'P', atoi(MYSQL_PORT));
+
+	printf (_("\
+ -d, --database=STRING\n\
+   Check database with indicated name\n\
+ -u, --username=STRING\n\
+   Connect using the indicated username\n\
+ -p, --password=STRING\n\
+   Use the indicated password to authenticate the connection\n\
+   ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n\
+   Your clear-text password will be visible as a process table entry\n"));
+
+	printf (_("\n\
+There are no required arguments. By default, the local database with\n\
+a server listening on MySQL standard port %d will be checked\n"), MYSQL_PORT);
+
+	printf (_(UT_SUPPORT));
+}
+
 char *db_user = "";
 char *db_user = "";
 char *db_host = "";
 char *db_host = "";
 char *db_pass = "";
 char *db_pass = "";
 char *db = "";
 char *db = "";
-unsigned int db_port = MYSQL_PORT;
 
 
 int process_arguments (int, char **);
 int process_arguments (int, char **);
 int validate_arguments (void);
 int validate_arguments (void);
-void print_help (void);
-void print_usage (void);
 
 
 int
 int
 main (int argc, char **argv)
 main (int argc, char **argv)
@@ -43,7 +84,7 @@ main (int argc, char **argv)
 	char result[1024];
 	char result[1024];
 
 
 	if (process_arguments (argc, argv) != OK)
 	if (process_arguments (argc, argv) != OK)
-		usage ("Invalid command arguments supplied\n");
+		usage (_("Invalid command arguments supplied\n"));
 
 
 	/* initialize mysql  */
 	/* initialize mysql  */
 	mysql_init (&mysql);
 	mysql_init (&mysql);
@@ -154,7 +195,7 @@ process_arguments (int argc, char **argv)
 				db_host = optarg;
 				db_host = optarg;
 			}
 			}
 			else {
 			else {
-				usage ("Invalid host name\n");
+				usage (_("Invalid host name\n"));
 			}
 			}
 			break;
 			break;
 		case 'd':									/* hostname */
 		case 'd':									/* hostname */
@@ -170,13 +211,13 @@ process_arguments (int argc, char **argv)
 			db_port = atoi (optarg);
 			db_port = atoi (optarg);
 			break;
 			break;
 		case 'V':									/* version */
 		case 'V':									/* version */
-			print_revision (progname, REVISION);
+			print_revision (progname, revision);
 			exit (STATE_OK);
 			exit (STATE_OK);
 		case 'h':									/* help */
 		case 'h':									/* help */
 			print_help ();
 			print_help ();
 			exit (STATE_OK);
 			exit (STATE_OK);
 		case '?':									/* help */
 		case '?':									/* help */
-			usage ("Invalid argument\n");
+			usage (_("Invalid argument\n"));
 		}
 		}
 	}
 	}
 
 
@@ -215,50 +256,3 @@ validate_arguments (void)
 {
 {
 	return OK;
 	return OK;
 }
 }
-
-
-
-
-
-void
-print_help (void)
-{
-	print_revision (progname, REVISION);
-	printf
-		("Copyright (c) 2000 Didi Rieder/Karl DeBisschop\n\n"
-		 "This plugin is for testing a mysql server.\n");
-	print_usage ();
-	printf
-		("\nThere are no required arguments. By default, the local database with\n"
-		 "a server listening on MySQL standard port %d will be checked\n\n"
-		 "Options:\n"
-		 " -d, --database=STRING\n"
-		 "   Check database with indicated name\n"
-		 " -H, --hostname=STRING or IPADDRESS\n"
-		 "   Check server on the indicated host\n"
-		 " -P, --port=INTEGER\n"
-		 "   Make connection on the indicated port\n"
-		 " -u, --username=STRING\n"
-		 "   Connect using the indicated username\n"
-		 " -p, --password=STRING\n"
-		 "   Use the indicated password to authenticate the connection\n"
-		 "   ==> IMPORTANT: THIS FORM OF AUTHENTICATION IS NOT SECURE!!! <==\n"
-		 "   Your clear-text password will be visible as a process table entry\n"
-		 " -h, --help\n"
-		 "    Print detailed help screen\n"
-		 " -V, --version\n" "    Print version information\n\n", MYSQL_PORT);
-	support ();
-}
-
-
-
-
-
-void
-print_usage (void)
-{
-	printf
-		("Usage: %s [-d database] [-H host] [-P port] [-u user] [-p password]\n"
-		 "       %s --help\n"
-		 "       %s --version\n", progname, progname, progname);
-}

+ 22 - 26
plugins/check_snmp.c

@@ -43,18 +43,14 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net";
 void
 void
 print_usage (void)
 print_usage (void)
 {
 {
-	printf ("\
+	printf (_("\
 Usage: %s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\
 Usage: %s -H <ip_address> -o <OID> [-w warn_range] [-c crit_range] \n\
   [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\
   [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\
   [-l label] [-u units] [-p port-number] [-d delimiter]\n\
   [-l label] [-u units] [-p port-number] [-d delimiter]\n\
   [-D output-delimiter] [-m miblist] [-P snmp version]\n\
   [-D output-delimiter] [-m miblist] [-P snmp version]\n\
   [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\
   [-L seclevel] [-U secname] [-a authproto] [-A authpasswd]\n\
-  [-X privpasswd]\n",
-	        progname);
-	printf ("\
-       %s (-h | --help) for detailed help\n\
-       %s (-V | --version) for version information\n",
-	        progname, progname);
+  [-X privpasswd]\n"), progname);
+	printf (_(UT_HLP_VRS), progname, progname);
 }
 }
 
 
 void
 void
@@ -160,7 +156,7 @@ Check status of remote machines and obtain sustem information via SNMP\n\n"));
 - All evaluation methods other than PR, STR, and SUBSTR expect that the value\n\
 - All evaluation methods other than PR, STR, and SUBSTR expect that the value\n\
   returned from the SNMP query is an unsigned integer.\n"));
   returned from the SNMP query is an unsigned integer.\n"));
 
 
-	support ();
+	printf (_(UT_SUPPORT));
 }
 }
 
 
 
 
@@ -271,7 +267,7 @@ main (int argc, char **argv)
 	i = 0;
 	i = 0;
 
 
 	if (process_arguments (argc, argv) == ERROR)
 	if (process_arguments (argc, argv) == ERROR)
-		usage ("Incorrect arguments supplied\n");
+		usage (_("Incorrect arguments supplied\n"));
 
 
 	/* create the command line to execute */
 	/* create the command line to execute */
 	asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s",
 	asprintf (&command_line, "%s -t 1 -r %d -m %s -v %s %s %s:%s %s",
@@ -283,13 +279,13 @@ main (int argc, char **argv)
 	/* run the command */
 	/* run the command */
 	child_process = spopen (command_line);
 	child_process = spopen (command_line);
 	if (child_process == NULL) {
 	if (child_process == NULL) {
-		printf ("Could not open pipe: %s\n", command_line);
+		printf (_("Could not open pipe: %s\n"), command_line);
 		exit (STATE_UNKNOWN);
 		exit (STATE_UNKNOWN);
 	}
 	}
 
 
 	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
 	child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r");
 	if (child_stderr == NULL) {
 	if (child_stderr == NULL) {
-		printf ("Could not open stderr for %s\n", command_line);
+		printf (_("Could not open stderr for %s\n"), command_line);
 	}
 	}
 
 
 	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process))
 	while (fgets (input_buffer, MAX_INPUT_BUFFER - 1, child_process))
@@ -388,14 +384,14 @@ main (int argc, char **argv)
 			}
 			}
 			else if (excode != REG_NOMATCH) {
 			else if (excode != REG_NOMATCH) {
 				regerror (excode, &preg, errbuf, MAX_INPUT_BUFFER);
 				regerror (excode, &preg, errbuf, MAX_INPUT_BUFFER);
-				printf ("Execute Error: %s\n", errbuf);
+				printf (_("Execute Error: %s\n"), errbuf);
 				exit (STATE_CRITICAL);
 				exit (STATE_CRITICAL);
 			}
 			}
 			else {
 			else {
 				iresult = STATE_CRITICAL;
 				iresult = STATE_CRITICAL;
 			}
 			}
 #else
 #else
-			printf ("%s UNKNOWN: call for regex which was not a compiled option", label);
+			printf (_("%s UNKNOWN: call for regex which was not a compiled option"), label);
 			exit (STATE_UNKNOWN);
 			exit (STATE_UNKNOWN);
 #endif
 #endif
 		}
 		}
@@ -433,7 +429,7 @@ main (int argc, char **argv)
 	if (found == 0)
 	if (found == 0)
 		terminate
 		terminate
 			(STATE_UNKNOWN,
 			(STATE_UNKNOWN,
-			 "%s problem - No data recieved from host\nCMD: %s\n",
+			 _("%s problem - No data recieved from host\nCMD: %s\n"),
 			 label, command_line);
 			 label, command_line);
 
 
 	/* WARNING if output found on stderr */
 	/* WARNING if output found on stderr */
@@ -554,14 +550,14 @@ process_arguments (int argc, char **argv)
 			break;
 			break;
 		case 't':	/* timeout period */
 		case 't':	/* timeout period */
 			if (!is_integer (optarg))
 			if (!is_integer (optarg))
-				usage2 ("Timeout Interval must be an integer", optarg);
+				usage2 (_("Timeout Interval must be an integer"), optarg);
 			timeout_interval = atoi (optarg);
 			timeout_interval = atoi (optarg);
 			break;
 			break;
 
 
 	/* Test parameters */
 	/* Test parameters */
 		case 'c':									/* critical time threshold */
 		case 'c':									/* critical time threshold */
 			if (strspn (optarg, "0123456789:,") < strlen (optarg)) {
 			if (strspn (optarg, "0123456789:,") < strlen (optarg)) {
-				printf ("Invalid critical threshold: %s\n", optarg);
+				printf (_("Invalid critical threshold: %s\n"), optarg);
 				print_usage ();
 				print_usage ();
 				exit (STATE_UNKNOWN);
 				exit (STATE_UNKNOWN);
 			}
 			}
@@ -575,7 +571,7 @@ process_arguments (int argc, char **argv)
 			break;
 			break;
 		case 'w':									/* warning time threshold */
 		case 'w':									/* warning time threshold */
 			if (strspn (optarg, "0123456789:,") < strlen (optarg)) {
 			if (strspn (optarg, "0123456789:,") < strlen (optarg)) {
-				printf ("Invalid warning threshold: %s\n", optarg);
+				printf (_("Invalid warning threshold: %s\n"), optarg);
 				print_usage ();
 				print_usage ();
 				exit (STATE_UNKNOWN);
 				exit (STATE_UNKNOWN);
 			}
 			}
@@ -622,13 +618,13 @@ process_arguments (int argc, char **argv)
 			errcode = regcomp (&preg, regex_expect, cflags);
 			errcode = regcomp (&preg, regex_expect, cflags);
 			if (errcode != 0) {
 			if (errcode != 0) {
 				regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER);
 				regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER);
-				printf ("Could Not Compile Regular Expression");
+				printf (_("Could Not Compile Regular Expression"));
 				return ERROR;
 				return ERROR;
 			}
 			}
 			eval_method[jj++] = CRIT_REGEX;
 			eval_method[jj++] = CRIT_REGEX;
 			ii++;
 			ii++;
 #else
 #else
-			printf ("%s UNKNOWN: call for regex which was not a compiled option", label);
+			printf (_("%s UNKNOWN: call for regex which was not a compiled option"), label);
 			exit (STATE_UNKNOWN);
 			exit (STATE_UNKNOWN);
 #endif
 #endif
 			break;
 			break;
@@ -648,7 +644,7 @@ process_arguments (int argc, char **argv)
 				labels = realloc (labels, labels_size);
 				labels = realloc (labels, labels_size);
 				if (labels == NULL)
 				if (labels == NULL)
 					terminate (STATE_UNKNOWN,
 					terminate (STATE_UNKNOWN,
-										 "Could not realloc() labels[%d]", nlabels);
+										 _("Could not realloc() labels[%d]"), nlabels);
 			}
 			}
 			labels[nlabels - 1] = optarg;
 			labels[nlabels - 1] = optarg;
 			ptr = thisarg (optarg);
 			ptr = thisarg (optarg);
@@ -661,7 +657,7 @@ process_arguments (int argc, char **argv)
 					labels_size += 8;
 					labels_size += 8;
 					labels = realloc (labels, labels_size);
 					labels = realloc (labels, labels_size);
 					if (labels == NULL)
 					if (labels == NULL)
-						terminate (STATE_UNKNOWN, "Could not realloc() labels\n");
+						terminate (STATE_UNKNOWN, _("Could not realloc() labels\n"));
 				}
 				}
 				labels++;
 				labels++;
 				ptr = thisarg (ptr);
 				ptr = thisarg (ptr);
@@ -679,7 +675,7 @@ process_arguments (int argc, char **argv)
 				unitv = realloc (unitv, unitv_size);
 				unitv = realloc (unitv, unitv_size);
 				if (unitv == NULL)
 				if (unitv == NULL)
 					terminate (STATE_UNKNOWN,
 					terminate (STATE_UNKNOWN,
-										 "Could not realloc() units [%d]\n", nunits);
+										 _("Could not realloc() units [%d]\n"), nunits);
 			}
 			}
 			unitv[nunits - 1] = optarg;
 			unitv[nunits - 1] = optarg;
 			ptr = thisarg (optarg);
 			ptr = thisarg (optarg);
@@ -692,7 +688,7 @@ process_arguments (int argc, char **argv)
 					unitv_size += 8;
 					unitv_size += 8;
 					unitv = realloc (unitv, unitv_size);
 					unitv = realloc (unitv, unitv_size);
 					if (units == NULL)
 					if (units == NULL)
-						terminate (STATE_UNKNOWN, "Could not realloc() units\n");
+						terminate (STATE_UNKNOWN, _("Could not realloc() units\n"));
 				}
 				}
 				nunits++;
 				nunits++;
 				ptr = thisarg (ptr);
 				ptr = thisarg (ptr);
@@ -759,7 +755,7 @@ validate_arguments ()
 		}
 		}
 		else if ( strcmp(seclevel, "authNoPriv") == 0 ) {
 		else if ( strcmp(seclevel, "authNoPriv") == 0 ) {
 			if ( secname == NULL || authpasswd == NULL) {
 			if ( secname == NULL || authpasswd == NULL) {
-				printf ("Missing secname (%s) or authpassword (%s) ! \n",secname, authpasswd );
+				printf (_("Missing secname (%s) or authpassword (%s) ! \n)"),secname, authpasswd );
 				print_usage ();
 				print_usage ();
 				exit (STATE_UNKNOWN);
 				exit (STATE_UNKNOWN);
 			}
 			}
@@ -767,7 +763,7 @@ validate_arguments ()
 		}
 		}
 		else if ( strcmp(seclevel, "authPriv") == 0 ) {
 		else if ( strcmp(seclevel, "authPriv") == 0 ) {
 			if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) {
 			if ( secname == NULL || authpasswd == NULL || privpasswd == NULL ) {
-				printf ("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n",secname, authpasswd,privpasswd );
+				printf (("Missing secname (%s), authpassword (%s), or privpasswd (%s)! \n"),secname, authpasswd,privpasswd );
 				print_usage ();
 				print_usage ();
 				exit (STATE_UNKNOWN);
 				exit (STATE_UNKNOWN);
 			}
 			}
@@ -777,7 +773,7 @@ validate_arguments ()
 									
 									
 	}
 	}
 	else {
 	else {
-		printf ("Invalid SNMP version: %s\n", proto);
+		printf (_("Invalid SNMP version: %s\n"), proto);
 		print_usage ();
 		print_usage ();
 		exit (STATE_UNKNOWN);				
 		exit (STATE_UNKNOWN);				
 	}
 	}

+ 4 - 0
plugins/utils.h

@@ -97,6 +97,10 @@ char *state_text (int result);
 #define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\n\
 #define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\n\
 \t<%s>\n\n"
 \t<%s>\n\n"
 
 
+#define UT_HLP_VRS "\
+       %s (-h | --help) for detailed help\n\
+       %s (-V | --version) for version information\n"
+
 #define UT_HELP_VRSN "\
 #define UT_HELP_VRSN "\
 \nOptions:\n\
 \nOptions:\n\
  -h, --help\n\
  -h, --help\n\