From 33a6787f51503d1b24f42e57cf365a48378dd56e Mon Sep 17 00:00:00 2001 From: Karl DeBisschop Date: Sat, 26 Jul 2003 04:17:17 +0000 Subject: checkins for internationalization git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@598 f882894a-f735-0410-b71e-b25c423dba1c diff --git a/.cvsignore b/.cvsignore index 82001b7..75dae47 100644 --- a/.cvsignore +++ b/.cvsignore @@ -7,6 +7,7 @@ test.pl command.cfg Cache.pm build-* +intl aclocal.m4 autom4te*.cache install-sh diff --git a/ABOUT-NLS b/ABOUT-NLS new file mode 100644 index 0000000..57e4b67 --- /dev/null +++ b/ABOUT-NLS @@ -0,0 +1,432 @@ +Notes on the Free Translation Project +************************************* + + Free software is going international! The Free Translation Project +is a way to get maintainers of free software, translators, and users all +together, so that will gradually become able to speak many languages. +A few packages already provide translations for their messages. + + If you found this `ABOUT-NLS' file inside a distribution, you may +assume that the distributed package does use GNU `gettext' internally, +itself available at your nearest GNU archive site. But you do _not_ +need to install GNU `gettext' prior to configuring, installing or using +this package with messages translated. + + Installers will find here some useful hints. These notes also +explain how users should proceed for getting the programs to use the +available translations. They tell how people wanting to contribute and +work at translations should contact the appropriate team. + + When reporting bugs in the `intl/' directory or bugs which may be +related to internationalization, you should tell about the version of +`gettext' which is used. The information can be found in the +`intl/VERSION' file, in internationalized packages. + +Quick configuration advice +========================== + + If you want to exploit the full power of internationalization, you +should configure it using + + ./configure --with-included-gettext + +to force usage of internationalizing routines provided within this +package, despite the existence of internationalizing capabilities in the +operating system where this package is being installed. So far, only +the `gettext' implementation in the GNU C library version 2 provides as +many features (such as locale alias, message inheritance, automatic +charset conversion or plural form handling) as the implementation here. +It is also not possible to offer this additional functionality on top +of a `catgets' implementation. Future versions of GNU `gettext' will +very likely convey even more functionality. So it might be a good idea +to change to GNU `gettext' as soon as possible. + + So you need _not_ provide this option if you are using GNU libc 2 or +you have installed a recent copy of the GNU gettext package with the +included `libintl'. + +INSTALL Matters +=============== + + Some packages are "localizable" when properly installed; the +programs they contain can be made to speak your own native language. +Most such packages use GNU `gettext'. Other packages have their own +ways to internationalization, predating GNU `gettext'. + + By default, this package will be installed to allow translation of +messages. It will automatically detect whether the system already +provides the GNU `gettext' functions. If not, the GNU `gettext' own +library will be used. This library is wholly contained within this +package, usually in the `intl/' subdirectory, so prior installation of +the GNU `gettext' package is _not_ required. Installers may use +special options at configuration time for changing the default +behaviour. The commands: + + ./configure --with-included-gettext + ./configure --disable-nls + +will respectively bypass any pre-existing `gettext' to use the +internationalizing routines provided within this package, or else, +_totally_ disable translation of messages. + + When you already have GNU `gettext' installed on your system and run +configure without an option for your new package, `configure' will +probably detect the previously built and installed `libintl.a' file and +will decide to use this. This might be not what is desirable. You +should use the more recent version of the GNU `gettext' library. I.e. +if the file `intl/VERSION' shows that the library which comes with this +package is more recent, you should use + + ./configure --with-included-gettext + +to prevent auto-detection. + + The configuration process will not test for the `catgets' function +and therefore it will not be used. The reason is that even an +emulation of `gettext' on top of `catgets' could not provide all the +extensions of the GNU `gettext' library. + + Internationalized packages have usually many `po/LL.po' files, where +LL gives an ISO 639 two-letter code identifying the language. Unless +translations have been forbidden at `configure' time by using the +`--disable-nls' switch, all available translations are installed +together with the package. However, the environment variable `LINGUAS' +may be set, prior to configuration, to limit the installed set. +`LINGUAS' should then contain a space separated list of two-letter +codes, stating which languages are allowed. + +Using This Package +================== + + As a user, if your language has been installed for this package, you +only have to set the `LANG' environment variable to the appropriate +`LL_CC' combination. Here `LL' is an ISO 639 two-letter language code, +and `CC' is an ISO 3166 two-letter country code. For example, let's +suppose that you speak German and live in Germany. At the shell +prompt, merely execute `setenv LANG de_DE' (in `csh'), +`export LANG; LANG=de_DE' (in `sh') or `export LANG=de_DE' (in `bash'). +This can be done from your `.login' or `.profile' file, once and for +all. + + You might think that the country code specification is redundant. +But in fact, some languages have dialects in different countries. For +example, `de_AT' is used for Austria, and `pt_BR' for Brazil. The +country code serves to distinguish the dialects. + + The locale naming convention of `LL_CC', with `LL' denoting the +language and `CC' denoting the country, is the one use on systems based +on GNU libc. On other systems, some variations of this scheme are +used, such as `LL' or `LL_CC.ENCODING'. You can get the list of +locales supported by your system for your country by running the command +`locale -a | grep '^LL''. + + Not all programs have translations for all languages. By default, an +English message is shown in place of a nonexistent translation. If you +understand other languages, you can set up a priority list of languages. +This is done through a different environment variable, called +`LANGUAGE'. GNU `gettext' gives preference to `LANGUAGE' over `LANG' +for the purpose of message handling, but you still need to have `LANG' +set to the primary language; this is required by other parts of the +system libraries. For example, some Swedish users who would rather +read translations in German than English for when Swedish is not +available, set `LANGUAGE' to `sv:de' while leaving `LANG' to `sv_SE'. + + In the `LANGUAGE' environment variable, but not in the `LANG' +environment variable, `LL_CC' combinations can be abbreviated as `LL' +to denote the language's main dialect. For example, `de' is equivalent +to `de_DE' (German as spoken in Germany), and `pt' to `pt_PT' +(Portuguese as spoken in Portugal) in this context. + +Translating Teams +================= + + For the Free Translation Project to be a success, we need interested +people who like their own language and write it well, and who are also +able to synergize with other translators speaking the same language. +Each translation team has its own mailing list. The up-to-date list of +teams can be found at the Free Translation Project's homepage, +`http://www.iro.umontreal.ca/contrib/po/HTML/', in the "National teams" +area. + + If you'd like to volunteer to _work_ at translating messages, you +should become a member of the translating team for your own language. +The subscribing address is _not_ the same as the list itself, it has +`-request' appended. For example, speakers of Swedish can send a +message to `sv-request@li.org', having this message body: + + subscribe + + Keep in mind that team members are expected to participate +_actively_ in translations, or at solving translational difficulties, +rather than merely lurking around. If your team does not exist yet and +you want to start one, or if you are unsure about what to do or how to +get started, please write to `translation@iro.umontreal.ca' to reach the +coordinator for all translator teams. + + The English team is special. It works at improving and uniformizing +the terminology in use. Proven linguistic skill are praised more than +programming skill, here. + +Available Packages +================== + + Languages are not equally supported in all packages. The following +matrix shows the current state of internationalization, as of July +2002. The matrix shows, in regard of each package, for which languages +PO files have been submitted to translation coordination, with a +translation percentage of at least 50%. + + Ready PO files be bg ca cs da de el en eo es et fi fr + +----------------------------------------+ + a2ps | [] [] [] [] | + bash | [] [] [] [] | + bfd | [] [] | + binutils | [] [] | + bison | [] [] [] [] | + clisp | [] [] [] [] | + clisp | | + clisplow | | + cpio | [] [] [] [] | + darkstat | () | + diffutils | [] [] [] [] [] [] | + enscript | [] [] | + error | [] [] [] | + fetchmail | [] () [] [] [] () | + fileutils | [] [] [] [] [] | + findutils | [] [] [] [] [] [] | + flex | [] [] [] [] [] | + gas | [] [] | + gawk | [] [] [] | + gcal | [] [] | + gcc | [] [] | + gettext | [] [] [] [] [] | + gnupg | [] [] [] [] [] [] [] | + gprof | [] [] | + gpsdrive | () () () () () | + grep | [] [] [] [] [] [] [] | + gretl | [] | + gthumb | () () () | + hello | [] [] [] [] [] [] [] [] [] | + id-utils | [] [] [] | + indent | [] [] [] [] [] | + jpilot | () [] [] [] | + jwhois | [] [] | + kbd | [] [] [] | + ld | [] [] | + libc | [] [] [] [] [] [] [] | + libiconv | [] [] [] [] | + lifelines | () () | + lilypond | [] [] [] | + lingoteach | [] [] | + lingoteach_lessons| () () | + lynx | [] [] [] [] [] | + m4 | [] [] [] [] [] | + make | [] [] [] [] | + man-db | [] () () [] () () | + mysecretdiary | [] [] [] | + nano | [] () [] [] [] [] | + nano_1_0 | [] () [] [] [] [] | + opcodes | [] [] [] | + parted | [] [] [] [] [] | + ptx | [] [] [] [] [] [] [] | + python | | + recode | [] [] [] [] [] [] | + sed | [] [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] [] | + sharutils | [] [] [] [] [] [] | + sketch | () [] () | + soundtracker | [] [] [] | + sp | [] | + tar | [] [] [] [] [] [] | + texinfo | [] [] [] [] [] | + textutils | [] [] [] [] [] | + util-linux | [] [] [] [] [] [] | + vorbis-tools | [] | + wastesedge | | + wdiff | [] [] [] [] [] [] | + wget | [] [] [] [] [] [] [] [] [] [] | + +----------------------------------------+ + be bg ca cs da de el en eo es et fi fr + 0 2 19 10 30 44 9 1 12 45 16 3 53 + + gl he hr hu id it ja ko lv nb nl nn + +-------------------------------------+ + a2ps | () () [] | + bash | [] | + bfd | [] | + binutils | [] | + bison | [] [] [] [] | + clisp | [] | + clisp | | + clisplow | | + cpio | [] [] [] [] | + darkstat | () | + diffutils | [] [] [] [] [] | + enscript | [] [] | + error | [] | + fetchmail | [] | + fileutils | [] [] [] | + findutils | [] [] [] [] [] [] [] [] | + flex | [] | + gas | | + gawk | [] | + gcal | | + gcc | [] | + gettext | [] [] | + gnupg | [] [] [] [] | + gprof | | + gpsdrive | [] () () | + grep | [] [] [] [] [] [] [] | + gretl | | + gthumb | () () | + hello | [] [] [] [] [] [] [] [] [] [] [] [] | + id-utils | [] [] | + indent | [] [] [] [] | + jpilot | () () | + jwhois | [] [] | + kbd | | + ld | | + libc | [] [] [] [] | + libiconv | [] [] [] | + lifelines | | + lilypond | [] [] | + lingoteach | [] | + lingoteach_lessons| | + lynx | [] [] [] [] | + m4 | [] [] [] [] | + make | [] [] [] [] [] [] | + man-db | () () | + mysecretdiary | [] | + nano | [] [] [] [] [] [] | + nano_1_0 | [] [] [] [] [] | + opcodes | [] [] | + parted | [] [] [] | + ptx | [] [] [] [] [] | + python | | + recode | [] [] [] | + sed | [] [] [] [] [] [] [] [] | + sh-utils | [] [] [] | + sharutils | [] [] [] | + sketch | () | + soundtracker | [] [] | + sp | | + tar | [] [] [] [] [] | + texinfo | [] [] [] | + textutils | [] [] [] | + util-linux | () [] | + vorbis-tools | | + wastesedge | | + wdiff | [] [] [] | + wget | [] [] [] [] [] [] | + +-------------------------------------+ + gl he hr hu id it ja ko lv nb nl nn + 23 9 12 18 14 13 26 9 1 8 19 4 + + no pl pt pt_BR ru sk sl sv tr uk zh_TW + +----------------------------------------+ + a2ps | () () () [] [] [] [] [] | 10 + bash | [] | 6 + bfd | [] [] | 5 + binutils | [] [] | 5 + bison | [] [] [] | 11 + clisp | | 5 + clisp | | 0 + clisplow | | 0 + cpio | [] [] [] [] | 12 + darkstat | [] () | 1 + diffutils | [] [] [] [] [] [] | 17 + enscript | [] [] [] [] | 8 + error | [] [] [] | 7 + fetchmail | () () [] | 6 + fileutils | [] [] [] [] [] | 13 + findutils | [] [] [] [] [] [] [] | 21 + flex | [] [] [] | 9 + gas | [] | 3 + gawk | [] [] | 6 + gcal | [] [] | 4 + gcc | [] | 4 + gettext | [] [] [] [] [] [] | 13 + gnupg | [] [] [] | 14 + gprof | [] [] | 4 + gpsdrive | [] [] () | 3 + grep | [] [] [] [] | 18 + gretl | | 1 + gthumb | () () [] | 1 + hello | [] [] [] [] [] [] [] | 28 + id-utils | [] [] [] [] | 9 + indent | [] [] [] [] [] | 14 + jpilot | () () [] | 4 + jwhois | [] () () [] [] | 7 + kbd | [] [] | 5 + ld | [] [] | 4 + libc | [] [] [] [] [] [] | 17 + libiconv | [] [] [] [] | 11 + lifelines | [] | 1 + lilypond | [] | 6 + lingoteach | [] [] | 5 + lingoteach_lessons| | 0 + lynx | [] [] [] [] | 13 + m4 | [] [] [] | 12 + make | [] [] [] [] | 14 + man-db | | 3 + mysecretdiary | [] [] [] | 7 + nano | [] [] [] [] | 15 + nano_1_0 | [] [] [] [] | 14 + opcodes | [] [] | 7 + parted | [] [] [] | 11 + ptx | [] [] [] [] [] [] [] | 19 + python | | 0 + recode | [] [] [] [] [] [] | 15 + sed | [] [] [] [] [] [] | 23 + sh-utils | [] | 8 + sharutils | [] [] [] [] | 13 + sketch | [] () [] | 4 + soundtracker | [] | 6 + sp | | 1 + tar | [] [] [] [] [] [] [] | 18 + texinfo | [] [] | 10 + textutils | [] [] [] [] [] | 13 + util-linux | [] [] [] | 10 + vorbis-tools | [] | 2 + wastesedge | | 0 + wdiff | [] [] [] [] [] | 14 + wget | [] [] [] [] [] [] [] [] | 24 + +----------------------------------------+ + 36 teams no pl pt pt_BR ru sk sl sv tr uk zh_TW + 67 domains 4 15 2 24 26 12 10 47 42 4 8 594 + + Some counters in the preceding matrix are higher than the number of +visible blocks let us expect. This is because a few extra PO files are +used for implementing regional variants of languages, or language +dialects. + + For a PO file in the matrix above to be effective, the package to +which it applies should also have been internationalized and +distributed as such by its maintainer. There might be an observable +lag between the mere existence a PO file and its wide availability in a +distribution. + + If July 2002 seems to be old, you may fetch a more recent copy of +this `ABOUT-NLS' file on most GNU archive sites. The most up-to-date +matrix with full percentage details can be found at +`http://www.iro.umontreal.ca/contrib/po/HTML/matrix.html'. + +Using `gettext' in new packages +=============================== + + If you are writing a freely available program and want to +internationalize it you are welcome to use GNU `gettext' in your +package. Of course you have to respect the GNU Library General Public +License which covers the use of the GNU `gettext' library. This means +in particular that even non-free programs can use `libintl' as a shared +library, whereas only free software can use `libintl' as a static +library or use modified versions of `libintl'. + + Once the sources are changed appropriately and the setup can handle +to use of `gettext' the only thing missing are the translations. The +Free Translation Project is also available for packages which are not +developed inside the GNU project. Therefore the information given above +applies also for every other Free Software Project. Contact +`translation@iro.umontreal.ca' to make the `.pot' files available to +the translation teams. + diff --git a/ChangeLog b/ChangeLog index 92b63df..965d436 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-07-02 gettextize + + * Makefile.am (SUBDIRS): Add intl. + (EXTRA_DIST): Add config.rpath. + * configure.in (AC_OUTPUT): Add intl/Makefile, + 2003-03-02 kdebisschop@alert.infoplease.com * configure.in, nagios-plugins.spec.in: diff --git a/Makefile.am b/Makefile.am index 02514aa..20d5590 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1,21 +1,25 @@ ## Process this file with automake to produce Makefile.in -SUBDIRS = lib plugins plugins-scripts +SUBDIRS = intl lib plugins plugins-scripts po -EXTRA_DIST = CODING FAQ LEGAL REQUIREMENTS SUPPORT \ +EXTRA_DIST = config.rpath \ + ABOUT-NLS CODING FAQ LEGAL REQUIREMENTS SUPPORT \ Helper.pm contrib pkg nagios-plugins.spec.in ACLOCAL_AMFLAGS = -I lib +localedir = $(datadir)/locale +DEFS = -DLOCALEDIR=\"$(localedir)\" + dist-hook: - sed "s/%%{VER}/${VER}/;s/%%{REL}/${REL}/;" $(srcdir)/nagios-plugins.spec.in > $(distdir)/nagios-plugins.spec + sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;" $(srcdir)/nagios-plugins.spec.in > $(distdir)/nagios-plugins.spec test: cd plugins; $(MAKE) test cd plugins-scripts; $(MAKE) test nagios-plugins.spec: nagios-plugins.spec.in - sed "s/%%{VER}/${VER}/;s/%%{REL}/${REL}/;" $? > $@ + sed "s/%%{VERSION}/${VERSION}/;s/%%{RELEASE}/${RELEASE}/;" $? > $@ # Solaris pkgmk BUILDDIR = build-solaris diff --git a/configure.in b/configure.in index a6261c6..5c067b4 100644 --- a/configure.in +++ b/configure.in @@ -1,23 +1,18 @@ dnl Process this file with autoconf to produce a configure script. AC_REVISION ($Revision$) AC_PREREQ(2.50) -AC_INIT(Helper.pm) -VER=1.3.99 -REL=1 -AC_SUBST(VER) -AC_SUBST(REL) -PACKAGE_VERSION="${VER}" -AC_SUBST(PACKAGE_VERSION) -PACKAGE_RELEASE="${REL}" -AC_SUBST(PACKAGE_RELEASE) -AM_INIT_AUTOMAKE(nagios-plugins,${PACKAGE_VERSION}) +AC_INIT(nagios-plugins,1.3.99) +AC_CONFIG_SRCDIR(Helper.pm) +AM_INIT_AUTOMAKE AM_CONFIG_HEADER(plugins/config.h) AC_CANONICAL_HOST +RELEASE=1 +AC_SUBST(RELEASE) + AC_PREFIX_DEFAULT(/usr/local/nagios) dnl Figure out how to invoke "install" and what install options to use. - AC_PROG_INSTALL AC_SUBST(INSTALL) @@ -1394,9 +1389,10 @@ AC_SUBST(EXTRAS) AC_SUBST(EXTRA_NETOBJS) AC_SUBST(DEPLIBS) -AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"${VERSION}",[package version]) +GETTEXT_VERSION=0.11.4 +AM_GNU_GETTEXT -AC_OUTPUT(Makefile lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl pkg/solaris/pkginfo) +AC_OUTPUT(Makefile lib/Makefile plugins/Makefile plugins-scripts/Makefile plugins-scripts/subst plugins-scripts/utils.pm plugins-scripts/utils.sh command.cfg test.pl pkg/solaris/pkginfo intl/Makefile po/Makefile.in ) ACX_FEATURE([with],[cgiurl]) ACX_FEATURE([with],[nagios-user]) diff --git a/lib/Makefile.am b/lib/Makefile.am index 4c99944..da8f678 100644 --- a/lib/Makefile.am +++ b/lib/Makefile.am @@ -6,6 +6,6 @@ noinst_HEADERS = getopt.h fsusage.h mountlist.h libnagiosplug_a_SOURCES = getopt.c getopt1.c getloadavg.c snprintf.c fsusage.c mountlist.c -EXTRA_DIST = afs.m4 fstypename.m4 fsusage.m4 ls-mntd-fs.m4 +EXTRA_DIST = codeset.m4 gettext.m4 glibc21.m4 iconv.m4 intdiv0.m4 inttypes.m4 inttypes_h.m4 inttypes-pri.m4 isc-posix.m4 lcmessage.m4 lib-ld.m4 lib-link.m4 lib-prefix.m4 progtest.m4 stdint_h.m4 uintmax_t.m4 afs.m4 fstypename.m4 fsusage.m4 ls-mntd-fs.m4 INCLUDES = -I$(srcdir) diff --git a/lib/gettext.h b/lib/gettext.h new file mode 100644 index 0000000..8b262f4 --- /dev/null +++ b/lib/gettext.h @@ -0,0 +1,69 @@ +/* Convenience header for conditional use of GNU . + Copyright (C) 1995-1998, 2000-2002 Free Software Foundation, Inc. + + This program is free software; you can redistribute it and/or modify it + under the terms of the GNU Library General Public License as published + by the Free Software Foundation; either version 2, or (at your option) + any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public + License along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, + USA. */ + +#ifndef _LIBGETTEXT_H +#define _LIBGETTEXT_H 1 + +/* NLS can be disabled through the configure --disable-nls option. */ +#if ENABLE_NLS + +/* Get declarations of GNU message catalog functions. */ +# include + +#else + +/* Solaris /usr/include/locale.h includes /usr/include/libintl.h, which + chokes if dcgettext is defined as a macro. So include it now, to make + later inclusions of a NOP. We don't include + as well because people using "gettext.h" will not include , + and also including would fail on SunOS 4, whereas + is OK. */ +#if defined(__sun) +# include +#endif + +/* Disabled NLS. + The casts to 'const char *' serve the purpose of producing warnings + for invalid uses of the value returned from these functions. + On pre-ANSI systems without 'const', the config.h file is supposed to + contain "#define const". */ +# define gettext(Msgid) ((const char *) (Msgid)) +# define dgettext(Domainname, Msgid) ((const char *) (Msgid)) +# define dcgettext(Domainname, Msgid, Category) ((const char *) (Msgid)) +# define ngettext(Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dngettext(Domainname, Msgid1, Msgid2, N) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define dcngettext(Domainname, Msgid1, Msgid2, N, Category) \ + ((N) == 1 ? (const char *) (Msgid1) : (const char *) (Msgid2)) +# define textdomain(Domainname) ((const char *) (Domainname)) +# define bindtextdomain(Domainname, Dirname) ((const char *) (Dirname)) +# define bind_textdomain_codeset(Domainname, Codeset) ((const char *) (Codeset)) + +#endif + +/* A pseudo function call that serves as a marker for the automated + extraction of messages, but does not call gettext(). The run-time + translation is done at a different place in the code. + The argument, String, should be a literal string. Concatenated strings + and other string expressions won't work. + The macro's expansion is not parenthesized, so that it is suitable as + initializer for static 'char[]' or 'const char[]' variables. */ +#define gettext_noop(String) String + +#endif /* _LIBGETTEXT_H */ diff --git a/nagios-plugins.spec.in b/nagios-plugins.spec.in index 912f5b3..2431f35 100644 --- a/nagios-plugins.spec.in +++ b/nagios-plugins.spec.in @@ -8,8 +8,8 @@ %define name %{archive} %endif -%define version %%{VER} -%define release %%{REL} +%define version %%{VERSION} +%define release %%{RELEASE} %define source %{archive}-%{version} Name: %{name} @@ -69,8 +69,11 @@ will need to install the '--nodeps' option when invoking `rpm` %build CFLAGS="$RPM_OPT_FLAGS" CXXFLAGS="$RPM_OPT_FLAGS" ./configure \ ---prefix=%{_prefix}/lib/nagios/plugins \ ---libexecdir=%{_prefix}/lib/nagios/plugins \ +--prefix=%{_prefix} \ +--exec-prefix=%{_exec_prefix} \ +--libexecdir=%{_exec_prefix}/lib/nagios/plugins \ +--sysconfdir=%{_sysconfdir}/nagios \ +--datadir=%{_datadir} \ --with-cgiurl=/nagios/cgi-bin make @@ -90,68 +93,71 @@ rm -rf $RPM_BUILD_ROOT %doc CODING COPYING FAQ INSTALL LEGAL README REQUIREMENTS SUPPORT %doc ChangeLog command.cfg %defattr(775,root,root) -%dir %{_prefix}/lib/nagios/plugins +%dir %{_exec_prefix}/lib/nagios/plugins +%{_datadir}/locale/de/LC_MESSAGES/nagios-plugins.mo +%{_datadir}/locale/fr/LC_MESSAGES/nagios-plugins.mo %if %custom -%{_prefix}/lib/nagios/plugins/* +%{_exec_prefix}/lib/nagios/plugins/* %else -%{_prefix}/lib/nagios/plugins/check_by_ssh -%{_prefix}/lib/nagios/plugins/check_breeze -%{_prefix}/lib/nagios/plugins/check_dig -%{_prefix}/lib/nagios/plugins/check_disk -%{_prefix}/lib/nagios/plugins/check_disk_smb -%{_prefix}/lib/nagios/plugins/check_dns -%{_prefix}/lib/nagios/plugins/check_dummy -%{_prefix}/lib/nagios/plugins/check_flexlm -%{_prefix}/lib/nagios/plugins/check_ftp -%{_prefix}/lib/nagios/plugins/check_http -%{_prefix}/lib/nagios/plugins/check_ifoperstatus -%{_prefix}/lib/nagios/plugins/check_ifstatus -%{_prefix}/lib/nagios/plugins/check_imap -%{_prefix}/lib/nagios/plugins/check_ircd -%{_prefix}/lib/nagios/plugins/check_load -%{_prefix}/lib/nagios/plugins/check_log -%{_prefix}/lib/nagios/plugins/check_mailq -%{_prefix}/lib/nagios/plugins/check_mrtg -%{_prefix}/lib/nagios/plugins/check_mrtgtraf -%{_prefix}/lib/nagios/plugins/check_nagios -%{_prefix}/lib/nagios/plugins/check_nntp -%{_prefix}/lib/nagios/plugins/check_nt -%{_prefix}/lib/nagios/plugins/check_ntp -%{_prefix}/lib/nagios/plugins/check_nwstat -%{_prefix}/lib/nagios/plugins/check_oracle -%{_prefix}/lib/nagios/plugins/check_overcr -%{_prefix}/lib/nagios/plugins/check_ping -%{_prefix}/lib/nagios/plugins/check_pop -%{_prefix}/lib/nagios/plugins/check_procs -%{_prefix}/lib/nagios/plugins/check_real -%{_prefix}/lib/nagios/plugins/check_rpc -%{_prefix}/lib/nagios/plugins/check_sensors -%{_prefix}/lib/nagios/plugins/check_smtp -%{_prefix}/lib/nagios/plugins/check_ssh -%{_prefix}/lib/nagios/plugins/check_swap -%{_prefix}/lib/nagios/plugins/check_tcp -%{_prefix}/lib/nagios/plugins/check_time -%{_prefix}/lib/nagios/plugins/check_udp -%{_prefix}/lib/nagios/plugins/check_ups -%{_prefix}/lib/nagios/plugins/check_users -%{_prefix}/lib/nagios/plugins/check_wave -%{_prefix}/lib/nagios/plugins/negate -%{_prefix}/lib/nagios/plugins/utils.pm -%{_prefix}/lib/nagios/plugins/utils.sh -%{_prefix}/lib/nagios/plugins/urlize +%{_exec_prefix}/lib/nagios/plugins/check_by_ssh +%{_exec_prefix}/lib/nagios/plugins/check_breeze +%{_exec_prefix}/lib/nagios/plugins/check_dig +%{_exec_prefix}/lib/nagios/plugins/check_disk +%{_exec_prefix}/lib/nagios/plugins/check_disk_smb +%{_exec_prefix}/lib/nagios/plugins/check_dns +%{_exec_prefix}/lib/nagios/plugins/check_dummy +%{_exec_prefix}/lib/nagios/plugins/check_flexlm +%{_exec_prefix}/lib/nagios/plugins/check_ftp +%{_exec_prefix}/lib/nagios/plugins/check_http +%{_exec_prefix}/lib/nagios/plugins/check_ifoperstatus +%{_exec_prefix}/lib/nagios/plugins/check_ifstatus +%{_exec_prefix}/lib/nagios/plugins/check_imap +%{_exec_prefix}/lib/nagios/plugins/check_ircd +%{_exec_prefix}/lib/nagios/plugins/check_load +%{_exec_prefix}/lib/nagios/plugins/check_log +%{_exec_prefix}/lib/nagios/plugins/check_mailq +%{_exec_prefix}/lib/nagios/plugins/check_mrtg +%{_exec_prefix}/lib/nagios/plugins/check_mrtgtraf +%{_exec_prefix}/lib/nagios/plugins/check_nagios +%{_exec_prefix}/lib/nagios/plugins/check_nntp +%{_exec_prefix}/lib/nagios/plugins/check_nt +%{_exec_prefix}/lib/nagios/plugins/check_ntp +%{_exec_prefix}/lib/nagios/plugins/check_nwstat +%{_exec_prefix}/lib/nagios/plugins/check_oracle +%{_exec_prefix}/lib/nagios/plugins/check_overcr +%{_exec_prefix}/lib/nagios/plugins/check_ping +%{_exec_prefix}/lib/nagios/plugins/check_pop +%{_exec_prefix}/lib/nagios/plugins/check_procs +%{_exec_prefix}/lib/nagios/plugins/check_real +%{_exec_prefix}/lib/nagios/plugins/check_rpc +%{_exec_prefix}/lib/nagios/plugins/check_sensors +%{_exec_prefix}/lib/nagios/plugins/check_smtp +%{_exec_prefix}/lib/nagios/plugins/check_ssh +%{_exec_prefix}/lib/nagios/plugins/check_swap +%{_exec_prefix}/lib/nagios/plugins/check_tcp +%{_exec_prefix}/lib/nagios/plugins/check_time +%{_exec_prefix}/lib/nagios/plugins/check_udp +%{_exec_prefix}/lib/nagios/plugins/check_ups +%{_exec_prefix}/lib/nagios/plugins/check_users +%{_exec_prefix}/lib/nagios/plugins/check_wave +%{_exec_prefix}/lib/nagios/plugins/negate +%{_exec_prefix}/lib/nagios/plugins/utils.pm +%{_exec_prefix}/lib/nagios/plugins/utils.sh +%{_exec_prefix}/lib/nagios/plugins/urlize +%{_exec_prefix}/lib/nagios/plugins/check_file_age %endif %if ! %custom %files extras %defattr(775,root,root) -%{_prefix}/lib/nagios/plugins/check_fping -%{_prefix}/lib/nagios/plugins/check_game -%{_prefix}/lib/nagios/plugins/check_ldap -%{_prefix}/lib/nagios/plugins/check_mysql -%{_prefix}/lib/nagios/plugins/check_pgsql -%{_prefix}/lib/nagios/plugins/check_radius -%{_prefix}/lib/nagios/plugins/check_snmp -%{_prefix}/lib/nagios/plugins/check_hpjd +%{_exec_prefix}/lib/nagios/plugins/check_fping +%{_exec_prefix}/lib/nagios/plugins/check_game +%{_exec_prefix}/lib/nagios/plugins/check_ldap +%{_exec_prefix}/lib/nagios/plugins/check_mysql +%{_exec_prefix}/lib/nagios/plugins/check_pgsql +%{_exec_prefix}/lib/nagios/plugins/check_radius +%{_exec_prefix}/lib/nagios/plugins/check_snmp +%{_exec_prefix}/lib/nagios/plugins/check_hpjd %endif diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 6d817b1..19c02cd 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 ce4fd31..afb1a68 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 21facfc..2456c41 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 d0999c5..e63c8c0 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" diff --git a/po/LINGUAS b/po/LINGUAS new file mode 100644 index 0000000..6d25a92 --- /dev/null +++ b/po/LINGUAS @@ -0,0 +1 @@ +fr de \ No newline at end of file diff --git a/po/POTFILES.in b/po/POTFILES.in new file mode 100644 index 0000000..eb8529c --- /dev/null +++ b/po/POTFILES.in @@ -0,0 +1 @@ +plugins/check_tcp.c diff --git a/po/de.po b/po/de.po new file mode 100644 index 0000000..a9d5116 --- /dev/null +++ b/po/de.po @@ -0,0 +1,79 @@ +# German Language Translation File. +# Copyright (C) YEAR Nagios Plugin Development Group +# This file is distributed under the same license as the nagios-plugins package. +# Karl DeBisschop , 2003. +# +#, fuzzy +msgid "" +msgstr "" +"Project-Id-Version: nagios-plugins 1.3.99\n" +"POT-Creation-Date: 2003-07-25 23:10-0400\n" +"PO-Revision-Date: 2003-07-20 22:24-0400\n" +"Last-Translator: Michael Wirtgen \n" +"Language-Team: de \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: plugins/check_tcp.c:516 +#, c-format +msgid "This plugin tests %s connections with the specified host.\n" +msgstr "" + +#: plugins/check_tcp.c:523 +msgid "" +" -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" +msgstr "" + +#: plugins/check_tcp.c:534 +msgid "" +" -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" +msgstr "" + +#: plugins/check_tcp.c:542 +msgid "" +" -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" +msgstr "" + +#: plugins/check_tcp.c:554 +#, c-format +msgid "" +" -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" +msgstr "" + +#: plugins/check_tcp.c:571 +msgid "" +"-H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n" +"\t[-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n" +"\t[-t to_sec] [-r refuse_state] [-v] [-4|-6]\n" +msgstr "" diff --git a/po/fr.po b/po/fr.po new file mode 100644 index 0000000..8f035a0 --- /dev/null +++ b/po/fr.po @@ -0,0 +1,115 @@ +# Messages français pour Nagios Plugins +# Copyright (C) 2003 Nagios Plugin Development Group +# This file is distributed under the same license as the PACKAGE package. +# Karl DeBisschop , 2003. +# +msgid "" +msgstr "" +"Project-Id-Version: nagios-plugins 1.3.99\n" +"POT-Creation-Date: 2003-07-25 23:10-0400\n" +"PO-Revision-Date: 2003-07-25 06:55-0400\n" +"Last-Translator: Pierre-Antoine Angelini \n" +"Language-Team: French \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" + +#: plugins/check_tcp.c:516 +#, c-format +msgid "This plugin tests %s connections with the specified host.\n" +msgstr "Le plugin tests a %s connection with l'host specified\n" + +#: plugins/check_tcp.c:523 +msgid "" +" -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" +msgstr "" +" -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" + +#: plugins/check_tcp.c:534 +msgid "" +" -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" +msgstr "" +" -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" + +#: plugins/check_tcp.c:542 +msgid "" +" -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" +msgstr "" +" -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" + +#: plugins/check_tcp.c:554 +#, c-format +msgid "" +" -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" +msgstr "" +" -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" + +#: plugins/check_tcp.c:571 +msgid "" +"-H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n" +"\t[-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n" +"\t[-t to_sec] [-r refuse_state] [-v] [-4|-6]\n" +msgstr "" +"-H host -p port [-w warn_time] [-c crit_time] [-s send_string]\n" +"\t[-e expect_string] [-q quit_string] [-m maxbytes] [-d delay]\n" +"\t[-t to_sec] [-r refuse_state] [-v] [-4|-6]\n" diff --git a/tools/setup b/tools/setup index 084399b..eb07b71 100755 --- a/tools/setup +++ b/tools/setup @@ -31,6 +31,7 @@ aclocal -I lib autoheader automake --add-missing --copy autoconf +autopoint if [ -f debian/rules ] ; then chmod +x debian/rules -- cgit v0.10-9-g596f