From 2ad398d2e04717ce3a6a8fb869e855c42581a30a Mon Sep 17 00:00:00 2001 From: Benoit Mortier Date: Fri, 3 Dec 2004 16:56:27 +0000 Subject: fixes for internationalization git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@990 f882894a-f735-0410-b71e-b25c423dba1c --- AUTHORS | 1 + plugins/check_load.c | 1 + plugins/check_pgsql.c | 13 ++--- plugins/check_ping.c | 20 ++++---- plugins/check_procs.c | 136 ++++++++++++++++++++++++------------------------- plugins/check_radius.c | 2 +- plugins/check_real.c | 3 +- plugins/check_smtp.c | 2 +- plugins/check_snmp.c | 7 +-- plugins/check_ssh.c | 6 +-- plugins/check_swap.c | 9 ++-- plugins/check_tcp.c | 8 +-- plugins/check_time.c | 5 +- plugins/check_udp.c | 9 ++-- plugins/check_ups.c | 6 +-- plugins/check_users.c | 3 +- plugins/urlize.c | 4 +- 17 files changed, 119 insertions(+), 116 deletions(-) diff --git a/AUTHORS b/AUTHORS index adec06e2..59a33a58 100644 --- a/AUTHORS +++ b/AUTHORS @@ -137,3 +137,4 @@ Alain Richard Arnaud Quette Alen Salamun Russell Miller +John Sivak \ No newline at end of file diff --git a/plugins/check_load.c b/plugins/check_load.c index 00bfc8a6..6d87237f 100644 --- a/plugins/check_load.c +++ b/plugins/check_load.c @@ -321,5 +321,6 @@ print_usage (void) { printf ("Usage: %s -w WLOAD1,WLOAD5,WLOAD15 -c CLOAD1,CLOAD5,CLOAD15\n"), progname); + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_pgsql.c b/plugins/check_pgsql.c index 826a1057..f97ef66c 100644 --- a/plugins/check_pgsql.c +++ b/plugins/check_pgsql.c @@ -441,12 +441,9 @@ a password, but no effort is made to obsure or encrypt the password.\n")); void print_usage (void) { - printf (S_("\ -Usage:\n %s [-H ] [-P ] [-c ] [-w ]\n\ - [-t ]"), progname); - printf (S_("[-d ] [-l ] [-p ]\n")); - printf (S_("\ - %s (-h | --help) for detailed help\n\ - %s (-V | --version) for version information\n"), - progname, progname); + printf ("\ +Usage: %s [-H ] [-P ] [-c ] [-w ]\n\ + [-t ] [-d ] [-l ] [-p ]\n", progname); + + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_ping.c b/plugins/check_ping.c index 132453d2..c04fb027 100644 --- a/plugins/check_ping.c +++ b/plugins/check_ping.c @@ -484,17 +484,6 @@ error_scan (char buf[MAX_INPUT_BUFFER], const char *addr) -void -print_usage (void) -{ - printf (\ -"Usage: %s -H -w ,%% -c ,%%\n\ - [-p packets] [-t timeout] [-L] [-4|-6]\n", progname); - printf (_(UT_HLP_VRS), progname, progname); -} - - - void print_help (void) { @@ -539,3 +528,12 @@ the contrib area of the downloads section at http://www.nagios.org\n\n")); printf (_(UT_SUPPORT)); } + +void +print_usage (void) +{ + printf ("Usage: %s -H -w ,%% -c ,%%\n\ + [-p packets] [-t timeout] [-L] [-4|-6]\n", progname); + + printf (UT_HLP_VRS, progname, progname); +} diff --git a/plugins/check_procs.c b/plugins/check_procs.c index a8a7d5e8..ee168db2 100644 --- a/plugins/check_procs.c +++ b/plugins/check_procs.c @@ -589,6 +589,71 @@ check_thresholds (int value) + +/* convert the elapsed time to seconds */ +int +convert_to_seconds(char *etime) { + + char *ptr; + int total; + + int hyphcnt; + int coloncnt; + int days; + int hours; + int minutes; + int seconds; + + hyphcnt = 0; + coloncnt = 0; + days = 0; + hours = 0; + minutes = 0; + seconds = 0; + + for (ptr = etime; *ptr != '\0'; ptr++) { + + if (*ptr == '-') { + hyphcnt++; + continue; + } + if (*ptr == ':') { + coloncnt++; + continue; + } + } + + if (hyphcnt > 0) { + sscanf(etime, "%d-%d:%d:%d", + &days, &hours, &minutes, &seconds); + /* linux 2.6.5/2.6.6 reporting some processes with infinite + * elapsed times for some reason */ + if (days == 49710) { + return 0; + } + } else { + if (coloncnt == 2) { + sscanf(etime, "%d:%d:%d", + &hours, &minutes, &seconds); + } else if (coloncnt == 1) { + sscanf(etime, "%d:%d", + &minutes, &seconds); + } + } + + total = (days * 86400) + + (hours * 3600) + + (minutes * 60) + + seconds; + + if (verbose >= 3) { + printf("seconds: %d\n", total); + } + return total; +} + + + void print_help (void) { @@ -681,78 +746,13 @@ Examples:\n\ printf (_(UT_SUPPORT)); } - - -/* convert the elapsed time to seconds */ -int -convert_to_seconds(char *etime) { - - char *ptr; - int total; - - int hyphcnt; - int coloncnt; - int days; - int hours; - int minutes; - int seconds; - - hyphcnt = 0; - coloncnt = 0; - days = 0; - hours = 0; - minutes = 0; - seconds = 0; - - for (ptr = etime; *ptr != '\0'; ptr++) { - - if (*ptr == '-') { - hyphcnt++; - continue; - } - if (*ptr == ':') { - coloncnt++; - continue; - } - } - - if (hyphcnt > 0) { - sscanf(etime, "%d-%d:%d:%d", - &days, &hours, &minutes, &seconds); - /* linux 2.6.5/2.6.6 reporting some processes with infinite - * elapsed times for some reason */ - if (days == 49710) { - return 0; - } - } else { - if (coloncnt == 2) { - sscanf(etime, "%d:%d:%d", - &hours, &minutes, &seconds); - } else if (coloncnt == 1) { - sscanf(etime, "%d:%d", - &minutes, &seconds); - } - } - - total = (days * 86400) + - (hours * 3600) + - (minutes * 60) + - seconds; - - if (verbose >= 3) { - printf("seconds: %d\n", total); - } - return total; -} - void print_usage (void) { printf ("\ Usage: %s -w -c [-m metric] [-s state] [-p ppid]\n\ [-u user] [-r rss] [-z vsz] [-P %%cpu] [-a argument-array]\n\ - [-C command] [-t timeout] [-v]\n", progname); - printf (_(UT_HLP_VRS), progname, progname); + [-C command] [-t timeout] [-v]\n", progname); + + printf (UT_HLP_VRS, progname, progname); } - - diff --git a/plugins/check_radius.c b/plugins/check_radius.c index 57a3e407..54746144 100644 --- a/plugins/check_radius.c +++ b/plugins/check_radius.c @@ -336,5 +336,5 @@ print_usage (void) printf ("\ Usage: %s -H host -F config_file -u username -p password [-n nas-id] [-P port]\n\ [-t timeout] [-r retries] [-e expect]\n", progname); - printf (_(UT_HLP_VRS), progname, progname); + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_real.c b/plugins/check_real.c index 8a12a3e5..8df68d90 100644 --- a/plugins/check_real.c +++ b/plugins/check_real.c @@ -439,5 +439,6 @@ print_usage (void) printf ("\ Usage: %s -H host [-e expect] [-p port] [-w warn] [-c crit]\n\ [-t timeout] [-v]\n", progname); - printf (_(UT_HLP_VRS), progname, progname); + + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_smtp.c b/plugins/check_smtp.c index c0ddc703..748edfca 100644 --- a/plugins/check_smtp.c +++ b/plugins/check_smtp.c @@ -469,5 +469,5 @@ print_usage (void) printf ("\ Usage: %s -H host [-p port] [-e expect] [-C command] [-f from addr]\n\ [-w warn] [-c crit] [-t timeout] [-n] [-v] [-4|-6]\n", progname); - printf (_(UT_HLP_VRS), progname, progname); + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_snmp.c b/plugins/check_snmp.c index 2e9ea63c..ca6d7a37 100644 --- a/plugins/check_snmp.c +++ b/plugins/check_snmp.c @@ -948,12 +948,13 @@ Check status of remote machines and obtain sustem information via SNMP\n\n")); 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 (_(UT_HLP_VRS), progname, progname); + [-X privpasswd]\n", progname); + + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_ssh.c b/plugins/check_ssh.c index a21d64a4..a21e2f52 100644 --- a/plugins/check_ssh.c +++ b/plugins/check_ssh.c @@ -287,9 +287,9 @@ print_help (void) void print_usage (void) { - printf (_("\ + printf ("\ Usage: %s [-46] [-t ] [-r ] [-p ] \n"), progname); - printf (_(UT_HLP_VRS), progname, progname); + + printf (UT_HLP_VRS, progname, progname); } -/* end of check_ssh.c */ diff --git a/plugins/check_swap.c b/plugins/check_swap.c index 6857a01b..6a448e10 100644 --- a/plugins/check_swap.c +++ b/plugins/check_swap.c @@ -514,10 +514,9 @@ On AIX, if -a is specified, uses lsps -a, otherwise uses lsps -s.\n")); void print_usage (void) { - printf (_("Usage:\n\ + printf ("Usage:\n\ %s [-av] -w %% -c %%\n\ - %s [-av] -w -c \n\ - %s (-h | --help) for detailed help\n\ - %s (-V | --version) for version information\n"), - progname, progname, progname, progname); + %s [-av] -w -c \n", progname, progname); + + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c index 05737764..405a7629 100644 --- a/plugins/check_tcp.c +++ b/plugins/check_tcp.c @@ -793,12 +793,12 @@ print_help (void) void print_usage (void) { - printf (_("\ + printf ("\ Usage: %s -H host -p port [-w ] [-c ]\n\ [-s ] [-e ] [-q ]\n\ [-m ] [-d ] [-t ]\n\ [-r ] [-v] [-4|-6] [-j] [-D ]\n\ - [-S ]\n"), progname); - printf (" %s (-h|--help)\n", progname); - printf (" %s (-V|--version)\n", progname); + [-S ]\n", progname); + + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_time.c b/plugins/check_time.c index 8381fb2f..94c33b6c 100644 --- a/plugins/check_time.c +++ b/plugins/check_time.c @@ -357,8 +357,9 @@ This plugin will check the time on the specified host.\n\n")); void print_usage (void) { - printf (_("\ + printf ("\ Usage: %s -H [-p port] [-u] [-w variance] [-c variance]\n\ - [-W connect_time] [-C connect_time] [-t timeout]\n"), progname); + [-W connect_time] [-C connect_time] [-t timeout]\n", progname); + printf (_(UT_HLP_VRS), progname, progname); } diff --git a/plugins/check_udp.c b/plugins/check_udp.c index 5adf23c4..6551ed40 100644 --- a/plugins/check_udp.c +++ b/plugins/check_udp.c @@ -225,7 +225,7 @@ print_help (void) printf (COPYRIGHT, copyright, email); printf (_("\ -This plugin tests an UDP connection with the specified host.\n\n")); + This plugin tests an UDP connection with the specified host.\n\n")); print_usage (); @@ -262,8 +262,9 @@ STATE_CRITICAL, other errors return STATE_UNKNOWN.\n\n")); void print_usage (void) { - printf (_("\ + printf ("\ Usage: %s -H [-p port] [-w warn_time] [-c crit_time]\n\ - [-e expect] [-s send] [-t to_sec] [-v]\n"), progname); - printf (_(UT_HLP_VRS), progname, progname); + [-e expect] [-s send] [-t to_sec] [-v]\n", progname); + + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 3e538bca..ee373cbd 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -647,8 +647,8 @@ http://www.networkupstools.org\n\n")); void print_usage (void) { - printf (_("\ + printf ("\ Usage: %s -H host -u ups [-p port] [-v variable]\n\ - [-wv warn_value] [-cv crit_value] [-to to_sec] [-T]\n"), progname); - printf (_(UT_HLP_VRS), progname, progname); + [-wv warn_value] [-cv crit_value] [-to to_sec] [-T]\n", progname); + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/check_users.c b/plugins/check_users.c index d0893225..05ef86fd 100644 --- a/plugins/check_users.c +++ b/plugins/check_users.c @@ -215,5 +215,6 @@ void print_usage (void) { printf ("Usage: %s -w -c \n", progname); - printf (_(UT_HLP_VRS), progname, progname); + + printf (UT_HLP_VRS, progname, progname); } diff --git a/plugins/urlize.c b/plugins/urlize.c index 65a7b3dd..e1d02ef8 100644 --- a/plugins/urlize.c +++ b/plugins/urlize.c @@ -162,5 +162,7 @@ You probably want:\n\ void print_usage (void) { - printf (_("Usage:\n %s ... \n"), progname); + printf ("Usage:\n %s ... \n", progname); + + printf (UT_HLP_VRS, progname, progname); } -- cgit v1.2.3