From 561da286a12ae7abb9d120b7ca87ffe46a225250 Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Sat, 2 Aug 2003 22:06:06 +0000 Subject: markupf for translation git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@634 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/plugins/check_fping.c b/plugins/check_fping.c index 86170d5..16e177c 100644 --- a/plugins/check_fping.c +++ b/plugins/check_fping.c @@ -88,7 +88,7 @@ time (ms) which triggers a WARNING or CRITICAL state, and is the\n\ percentage of packet loss to trigger an alarm state.\n")); } - + int textscan (char *buf); int process_arguments (int, char **); int get_threshold (char *arg, char *rv[2]); @@ -112,7 +112,7 @@ main (int argc, char **argv) input_buffer = malloc (MAX_INPUT_BUFFER); if (process_arguments (argc, argv) == ERROR) - usage ("Could not parse arguments\n"); + usage (_("Could not parse arguments\n")); server = strscpy (server, server_name); @@ -126,13 +126,13 @@ main (int argc, char **argv) /* run the command */ child_process = spopen (command_line); 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; } child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 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)) { @@ -173,16 +173,16 @@ textscan (char *buf) int status = STATE_UNKNOWN; 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")) { - terminate (STATE_CRITICAL, "FPING critical - %s is unreachable\n", + terminate (STATE_CRITICAL, _("FPING critical - %s is unreachable\n"), "host"); } 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")) { @@ -208,7 +208,7 @@ textscan (char *buf) status = STATE_WARNING; else 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); } @@ -227,7 +227,7 @@ textscan (char *buf) else 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 ); } @@ -237,7 +237,7 @@ textscan (char *buf) return status; } - + @@ -282,21 +282,21 @@ process_arguments (int argc, char **argv) switch (c) { 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 (); exit (STATE_UNKNOWN); case 'h': /* help */ print_help (); exit (STATE_OK); case 'V': /* version */ - print_revision (progname, "$Revision$"); + print_revision (progname, revision); exit (STATE_OK); case 'v': /* verbose mode */ verbose = TRUE; break; case 'H': /* hostname */ if (is_host (optarg) == FALSE) { - printf ("Invalid host name/address\n\n"); + printf (_("Invalid host name/address\n\n")); print_usage (); exit (STATE_UNKNOWN); } @@ -328,20 +328,20 @@ process_arguments (int argc, char **argv) if (is_intpos (optarg)) packet_size = atoi (optarg); else - usage ("Packet size must be a positive integer"); + usage (_("Packet size must be a positive integer")); break; case 'n': /* number of packets */ if (is_intpos (optarg)) packet_count = atoi (optarg); else - usage ("Packet count must be a positive integer"); + usage (_("Packet count must be a positive integer")); break; } } if (server_name == NULL) - usage ("Host name was not supplied\n\n"); + usage (_("Host name was not supplied\n\n")); return OK; } @@ -364,11 +364,11 @@ get_threshold (char *arg, char *rv[2]) arg1[strcspn (arg1, ",:")] = 0; if (strstr (arg1, "%") && strstr (arg2, "%")) 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); if (!strstr (arg1, "%") && !strstr (arg2, "%")) 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); } diff --git a/plugins/check_game.c b/plugins/check_game.c index db28dfd..811da27 100644 --- a/plugins/check_game.c +++ b/plugins/check_game.c @@ -19,34 +19,52 @@ const char *progname = "check_game"; const char *revision = "$Revision$"; const char *copyright = "2002-2003"; -const char *authors = "Nagios Plugin Development Team"; 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 [-p port] [-gf game_field] [-mf map_field] [-pf ping_field]\n"; +void +print_usage (void) +{ + printf (_("\ +Usage: %s [-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 type that is recognised by qstat (without the leading dash)\n\ = The IP address of the device you wish to query\n\ [port] = Optional port of which to connect\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\ - [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\ - 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\ - 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 validate_arguments (void); @@ -83,11 +101,11 @@ main (int argc, char **argv) result = process_arguments (argc, argv); if (result != OK) { - printf ("Incorrect arguments supplied\n"); + printf (_("Incorrect arguments supplied\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"); return STATE_UNKNOWN; } @@ -107,7 +125,7 @@ main (int argc, char **argv) /* run the command */ fp = spopen (command_line); 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; } @@ -127,7 +145,7 @@ main (int argc, char **argv) */ if (!strncmp (input_buffer, "unknown option", 14)) { - printf ("ERROR: Host type parameter incorrect!\n"); + printf (_("ERROR: Host type parameter incorrect!\n")); result = STATE_CRITICAL; return result; } @@ -217,7 +235,7 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* args not parsable */ - printf ("%s: Unknown argument: %s\n\n", progname, optarg); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); print_usage (); exit (STATE_UNKNOWN); case 'h': /* help */ @@ -234,7 +252,7 @@ process_arguments (int argc, char **argv) break; case 'H': /* hostname */ 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); break; case 'P': /* port */ @@ -242,7 +260,7 @@ process_arguments (int argc, char **argv) break; case 'G': /* hostname */ if (strlen (optarg) >= MAX_INPUT_BUFFER) - terminate (STATE_UNKNOWN, "Input buffer overflow\n"); + terminate (STATE_UNKNOWN, _("Input buffer overflow\n")); game_type = strdup (optarg); break; case 'p': /* index of ping field */ @@ -290,27 +308,3 @@ validate_arguments (void) { 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); -} - diff --git a/plugins/check_mysql.c b/plugins/check_mysql.c index 3074814..a18397d 100644 --- a/plugins/check_mysql.c +++ b/plugins/check_mysql.c @@ -15,25 +15,66 @@ ******************************************************************************/ 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 "utils.h" - +#include "netutils.h" #include #include +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_host = ""; char *db_pass = ""; char *db = ""; -unsigned int db_port = MYSQL_PORT; int process_arguments (int, char **); int validate_arguments (void); -void print_help (void); -void print_usage (void); int main (int argc, char **argv) @@ -43,7 +84,7 @@ main (int argc, char **argv) char result[1024]; if (process_arguments (argc, argv) != OK) - usage ("Invalid command arguments supplied\n"); + usage (_("Invalid command arguments supplied\n")); /* initialize mysql */ mysql_init (&mysql); @@ -154,7 +195,7 @@ process_arguments (int argc, char **argv) db_host = optarg; } else { - usage ("Invalid host name\n"); + usage (_("Invalid host name\n")); } break; case 'd': /* hostname */ @@ -170,13 +211,13 @@ process_arguments (int argc, char **argv) db_port = atoi (optarg); break; case 'V': /* version */ - print_revision (progname, REVISION); + print_revision (progname, revision); exit (STATE_OK); case 'h': /* help */ print_help (); exit (STATE_OK); case '?': /* help */ - usage ("Invalid argument\n"); + usage (_("Invalid argument\n")); } } @@ -215,50 +256,3 @@ validate_arguments (void) { 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); -} diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 821f10e..68ffaf5 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -43,18 +43,14 @@ const char *email = "nagiosplug-devel@lists.sourceforge.net"; void print_usage (void) { - printf ("\ + printf (_("\ Usage: %s -H -o [-w warn_range] [-c crit_range] \n\ [-C community] [-s string] [-r regex] [-R regexi] [-t timeout]\n\ [-l label] [-u units] [-p port-number] [-d delimiter]\n\ [-D output-delimiter] [-m miblist] [-P snmp version]\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 @@ -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\ 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; if (process_arguments (argc, argv) == ERROR) - usage ("Incorrect arguments supplied\n"); + usage (_("Incorrect arguments supplied\n")); /* create the command line to execute */ 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 */ child_process = spopen (command_line); 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); } child_stderr = fdopen (child_stderr_array[fileno (child_process)], "r"); 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)) @@ -388,14 +384,14 @@ main (int argc, char **argv) } else if (excode != REG_NOMATCH) { regerror (excode, &preg, errbuf, MAX_INPUT_BUFFER); - printf ("Execute Error: %s\n", errbuf); + printf (_("Execute Error: %s\n"), errbuf); exit (STATE_CRITICAL); } else { iresult = STATE_CRITICAL; } #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); #endif } @@ -433,7 +429,7 @@ main (int argc, char **argv) if (found == 0) terminate (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); /* WARNING if output found on stderr */ @@ -554,14 +550,14 @@ process_arguments (int argc, char **argv) break; case 't': /* timeout period */ if (!is_integer (optarg)) - usage2 ("Timeout Interval must be an integer", optarg); + usage2 (_("Timeout Interval must be an integer"), optarg); timeout_interval = atoi (optarg); break; /* Test parameters */ case 'c': /* critical time threshold */ if (strspn (optarg, "0123456789:,") < strlen (optarg)) { - printf ("Invalid critical threshold: %s\n", optarg); + printf (_("Invalid critical threshold: %s\n"), optarg); print_usage (); exit (STATE_UNKNOWN); } @@ -575,7 +571,7 @@ process_arguments (int argc, char **argv) break; case 'w': /* warning time threshold */ if (strspn (optarg, "0123456789:,") < strlen (optarg)) { - printf ("Invalid warning threshold: %s\n", optarg); + printf (_("Invalid warning threshold: %s\n"), optarg); print_usage (); exit (STATE_UNKNOWN); } @@ -622,13 +618,13 @@ process_arguments (int argc, char **argv) errcode = regcomp (&preg, regex_expect, cflags); if (errcode != 0) { regerror (errcode, &preg, errbuf, MAX_INPUT_BUFFER); - printf ("Could Not Compile Regular Expression"); + printf (_("Could Not Compile Regular Expression")); return ERROR; } eval_method[jj++] = CRIT_REGEX; ii++; #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); #endif break; @@ -648,7 +644,7 @@ process_arguments (int argc, char **argv) labels = realloc (labels, labels_size); if (labels == NULL) terminate (STATE_UNKNOWN, - "Could not realloc() labels[%d]", nlabels); + _("Could not realloc() labels[%d]"), nlabels); } labels[nlabels - 1] = optarg; ptr = thisarg (optarg); @@ -661,7 +657,7 @@ process_arguments (int argc, char **argv) labels_size += 8; labels = realloc (labels, labels_size); if (labels == NULL) - terminate (STATE_UNKNOWN, "Could not realloc() labels\n"); + terminate (STATE_UNKNOWN, _("Could not realloc() labels\n")); } labels++; ptr = thisarg (ptr); @@ -679,7 +675,7 @@ process_arguments (int argc, char **argv) unitv = realloc (unitv, unitv_size); if (unitv == NULL) terminate (STATE_UNKNOWN, - "Could not realloc() units [%d]\n", nunits); + _("Could not realloc() units [%d]\n"), nunits); } unitv[nunits - 1] = optarg; ptr = thisarg (optarg); @@ -692,7 +688,7 @@ process_arguments (int argc, char **argv) unitv_size += 8; unitv = realloc (unitv, unitv_size); if (units == NULL) - terminate (STATE_UNKNOWN, "Could not realloc() units\n"); + terminate (STATE_UNKNOWN, _("Could not realloc() units\n")); } nunits++; ptr = thisarg (ptr); @@ -759,7 +755,7 @@ validate_arguments () } else if ( strcmp(seclevel, "authNoPriv") == 0 ) { 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 (); exit (STATE_UNKNOWN); } @@ -767,7 +763,7 @@ validate_arguments () } else if ( strcmp(seclevel, "authPriv") == 0 ) { 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 (); exit (STATE_UNKNOWN); } @@ -777,7 +773,7 @@ validate_arguments () } else { - printf ("Invalid SNMP version: %s\n", proto); + printf (_("Invalid SNMP version: %s\n"), proto); print_usage (); exit (STATE_UNKNOWN); } diff --git a/plugins/utils.h b/plugins/utils.h index e581afa..83793e4 100644 --- a/plugins/utils.h +++ b/plugins/utils.h @@ -97,6 +97,10 @@ char *state_text (int result); #define COPYRIGHT "Copyright (c) %s Nagios Plugin Development Team\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 "\ \nOptions:\n\ -h, --help\n\ -- cgit v0.10-9-g596f