aboutsummaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-07-26 04:17:17 +0000
committerGravatar Karl DeBisschop <kdebisschop@users.sourceforge.net> 2003-07-26 04:17:17 +0000
commit33a6787f51503d1b24f42e57cf365a48378dd56e (patch)
treeed1f566f37269e6928ad733301b9529022f9c4cd /plugins
parent35d8e3500946289de2638596bc0f93b044acc42c (diff)
downloadmonitoring-plugins-33a6787f51503d1b24f42e57cf365a48378dd56e.tar.gz
checkins for internationalization
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@598 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am8
-rw-r--r--plugins/check_tcp.c123
-rw-r--r--plugins/common.h15
-rw-r--r--plugins/utils.c4
4 files changed, 85 insertions, 65 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index 6d817b1e..19c02cd8 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -2,7 +2,13 @@
VPATH = $(top_srcdir) $(top_srcdir)/lib $(top_srcdir)/plugins $(top_srcdir)/plugins/t
-INCLUDES = -I.. -I$(top_srcdir)/lib @LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
+INCLUDES = -I.. -I$(top_srcdir)/lib -I$(top_srcdir)/intl \
+@LDAPINCLUDE@ @PGINCLUDE@ @SSLINCLUDE@
+
+datadir = @datadir@
+localedir = $(datadir)/locale
+DEFS = -DLOCALEDIR=\"$(localedir)\" @DEFS@
+LIBS = @LIBINTL@ @LIBS@
libexec_PROGRAMS = check_disk check_dummy check_http check_load \
check_mrtg check_mrtgtraf check_nwstat check_overcr check_ping \
diff --git a/plugins/check_tcp.c b/plugins/check_tcp.c
index ce4fd31f..afb1a681 100644
--- a/plugins/check_tcp.c
+++ b/plugins/check_tcp.c
@@ -15,59 +15,6 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*****************************************************************************/
-
-/* progname changes depending on symlink called */
-char *progname = "check_tcp";
-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";
-
-const char *option_summary = "\
--H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\
- [-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\
- [-t to_sec] [-r refuse_state] [-v] [-4|-6]\n";
-
-const char *options = "\
- -H, --hostname=ADDRESS\n\
- Host name argument for servers using host headers (use numeric\n\
- address if possible to bypass DNS lookup).\n\
- -p, --port=INTEGER\n\
- Port number\n\
- -4, --use-ipv4\n\
- Use IPv4 connection\n\
- -6, --use-ipv6\n\
- Use IPv6 connection\n\
- -s, --send=STRING\n\
- String to send to the server\n\
- -e, --expect=STRING\n\
- String to expect in server response\n\
- -q, --quit=STRING\n\
- String to send server to initiate a clean close of the connection\n\
- -m, --maxbytes=INTEGER\n\
- Close connection once more than this number of bytes are received\n\
- -d, --delay=INTEGER\n\
- Seconds to wait between sending string and polling for response\n\
- -w, --warning=DOUBLE\n\
- Response time to result in warning status (seconds)\n\
- -c, --critical=DOUBLE\n\
- Response time to result in critical status (seconds)\n\
- -t, --timeout=INTEGER\n\
- Seconds before connection times out (default: %d)\n\
- -r, --refuse=ok|warn|crit\n\
- Accept tcp refusals with states ok, warn, crit (default: crit)\n\
- -v, --verbose\n\
- Show details for command-line debugging (Nagios may truncate output)\n";
-
-const char *standard_options = "\
- -h, --help\n\
- Print detailed help screen\n\
- -V, --version\n\
- Print version information\n\n";
-
#include "config.h"
#include "common.h"
#include "netutils.h"
@@ -137,6 +84,13 @@ int use_ssl = FALSE;
int sd = 0;
char *buffer = "";
+/* progname changes depending on symlink called */
+char *progname = "check_tcp";
+const char *revision = "$Revision$";
+const char *copyright = "2002-2003";
+const char *authors = "Nagios Plugin Development Team";
+const char *email = "nagiosplug-devel@lists.sourceforge.net";
+
int
main (int argc, char **argv)
{
@@ -145,6 +99,10 @@ main (int argc, char **argv)
char *status = "";
struct timeval tv;
+ setlocale (LC_ALL, "");
+ bindtextdomain (PACKAGE, LOCALEDIR);
+ textdomain (PACKAGE);
+
if (strstr (argv[0], "check_udp")) {
progname = strdup ("check_udp");
SERVICE = strdup ("UDP");
@@ -301,7 +259,7 @@ main (int argc, char **argv)
asprintf (&status, "%s%s", status, buffer);
if (buffer[i-2] == '\r' && buffer[i-1] == '\n')
break;
- if (maxbytes>0 && strlen(status)>=maxbytes)
+ if (maxbytes>0 && strlen(status) >= (unsigned)maxbytes)
break;
}
@@ -547,19 +505,68 @@ void
print_help (void)
{
print_revision (progname, revision);
+
printf ("Copyright (c) %s %s\n\t<%s>\n\n", copyright, authors, email);
- printf (summary, SERVICE);
+
+ printf (_("\
+This plugin tests %s connections with the specified host.\n"), SERVICE);
+
print_usage ();
+
printf ("\nOptions:\n");
- printf (options, DEFAULT_SOCKET_TIMEOUT);
- printf (standard_options);
+
+ printf (_("\
+ -H, --hostname=ADDRESS\n\
+ Host name argument for servers using host headers (use numeric\n\
+ address if possible to bypass DNS lookup).\n\
+ -p, --port=INTEGER\n\
+ Port number\n\
+ -4, --use-ipv4\n\
+ Use IPv4 connection\n\
+ -6, --use-ipv6\n\
+ Use IPv6 connection\n"));
+
+ printf (_("\
+ -s, --send=STRING\n\
+ String to send to the server\n\
+ -e, --expect=STRING\n\
+ String to expect in server response\n\
+ -q, --quit=STRING\n\
+ String to send server to initiate a clean close of the connection\n"));
+
+ printf (_("\
+ -r, --refuse=ok|warn|crit\n\
+ Accept tcp refusals with states ok, warn, crit (default: crit)\n\
+ -m, --maxbytes=INTEGER\n\
+ Close connection once more than this number of bytes are received\n\
+ -d, --delay=INTEGER\n\
+ Seconds to wait between sending string and polling for response\n\
+ -w, --warning=DOUBLE\n\
+ Response time to result in warning status (seconds)\n\
+ -c, --critical=DOUBLE\n\
+ Response time to result in critical status (seconds)\n"));
+
+ printf (_("\
+ -t, --timeout=INTEGER\n\
+ Seconds before connection times out (default: %d)\n\
+ -v, --verbose\n\
+ Show details for command-line debugging (Nagios may truncate output)\n\
+ -h, --help\n\
+ Print detailed help screen\n\
+ -V, --version\n\
+ Print version information\n\n"),
+ DEFAULT_SOCKET_TIMEOUT);
+
support ();
}
void
print_usage (void)
{
- printf ("Usage: %s %s\n", progname, option_summary);
+ printf ("Usage: %s %s\n", progname, _("\
+-H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n\
+ [-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n\
+ [-t to_sec] [-r refuse_state] [-v] [-4|-6]\n"));
printf (" %s (-h|--help)\n", progname);
printf (" %s (-V|--version)\n", progname);
}
diff --git a/plugins/common.h b/plugins/common.h
index 21facfc4..2456c417 100644
--- a/plugins/common.h
+++ b/plugins/common.h
@@ -156,7 +156,14 @@ enum {
*
*/
-#define _(String) (String)
-#define N_(String) String
-#define textdomain(Domain)
-#define bindtextdomain(Package, Directory)
+#if ENABLE_NLS
+# include "gettext.h"
+# define _(String) gettext (String)
+# define gettext_noop(String) String
+# define N_(String) gettext_noop String
+#else
+# define _(String) (String)
+# define N_(String) String
+# define textdomain(Domain)
+# define bindtextdomain(Package, Directory)
+#endif
diff --git a/plugins/utils.c b/plugins/utils.c
index d0999c58..e63c8c08 100644
--- a/plugins/utils.c
+++ b/plugins/utils.c
@@ -133,8 +133,8 @@ print_revision (const char *command_name, const char *revision_string)
if (sscanf (revision_string, "$Revision: %[0-9.]", plugin_revision) != 1)
strncpy (plugin_revision, "N/A", STRLEN);
- printf ("%s (nagios-plugins %s) %s\n",
- progname, VERSION, plugin_revision);
+ printf ("%s (%s %s) %s\n",
+ progname, PACKAGE, VERSION, plugin_revision);
printf
("The nagios plugins come with ABSOLUTELY NO WARRANTY. You may redistribute\n"
"copies of the plugins under the terms of the GNU General Public License.\n"