ngettext errors with --disable-nls (was Re: [Nagiosplug-devel] check_procs, check_ldap compile errors)
Ton Voon
tonvoon at mac.com
Fri Dec 3 01:01:15 CET 2004
Andreas,
Thanks for the patch. Yes, definitely a good practice to build with
--disable-nls every so often - will update my release notes to try this
before publishing a release.
While your patches are fine and Benoit has applied to CVS, I'd like to
know why ngettext does not work. I would expect ngettext to be
effectively void, such as _("message") is made void with --disable-nls.
Does anyone know if we are implementing or configuring gettext
incorrectly?
Ton
On 2 Dec 2004, at 13:30, Andreas Ericsson wrote:
> While localization is all good and dandy, try once in a while building
> with --disable-nls. It throws an error on check_dns, check_procs and
> check_ldap without this patch.
>
> The patch is trivial and I'm sure it'll work (although I haven't
> tested running the plugins, they build cleanly).
>
> Apply with patch -p1.
>
> --
> Andreas Ericsson andreas.ericsson at op5.se
> OP5 AB www.op5.se
> Lead Developer
> diff -urN ../nagiosplug.orig/plugins/check_ldap.c
> ./plugins/check_ldap.c
> --- ../nagiosplug.orig/plugins/check_ldap.c Thu Dec 2 14:12:56 2004
> +++ ./plugins/check_ldap.c Thu Dec 2 14:18:19 2004
> @@ -335,6 +335,13 @@
> Usage: %s -H <host> -b <base_dn> [-p <port>] [-a <attr>] [-D
> <binddn>]\n\
> [-P <password>] [-w <warn_time>] [-c <crit_time>] [-t timeout]%s\n\
> (Note: all times are in seconds.)\n"),
> - progname, (HAVE_LDAP_SET_OPTION ? "[-2|-3] [-4|-6]" : ""));
> + progname,
> +#ifdef HAVE_LDAP_SET_OPTION
> + " [-2|-3] [-4|-6]"
> +#else
> + ""
> +#endif
> + );
> +
> printf (_(UT_HLP_VRS), progname, progname);
> }
> diff -urN ../nagiosplug.orig/plugins/check_procs.c
> ./plugins/check_procs.c
> --- ../nagiosplug.orig/plugins/check_procs.c Thu Dec 2 13:43:43 2004
> +++ ./plugins/check_procs.c Thu Dec 2 14:16:27 2004
> @@ -278,7 +278,7 @@
> printf (_("%d crit, %d warn out of "), crit, warn);
> }
> }
> - printf (ngettext ("%d process", "%d processes", (unsigned long)
> procs), procs);
> + printf ("%d %s", procs, procs == 1 ? _("process") : _("processes"));
>
> if (strcmp(fmt,"") != 0) {
> printf (_(" with %s"), fmt);
> diff -urN ../nagiosplug.orig/plugins/check_dns.c ./plugins/check_dns.c
> --- ../nagiosplug.orig/plugins/check_dns.c Thu Dec 2 13:43:43 2004
> +++ ./plugins/check_dns.c Thu Dec 2 14:25:26 2004
> @@ -198,7 +198,7 @@
> multi_address = TRUE;
>
> printf ("DNS %s: ", _("OK"));
> - printf (ngettext("%.3f second response time, ", "%.3f seconds
> response time, ", elapsed_time), elapsed_time);
> + printf (_("%.3f seconds response time), ", elapsed_time);
> printf (_("%s returns %s"), query_address, address);
> printf ("|%s\n", fperfdata ("time", elapsed_time, "s", FALSE, 0,
> FALSE, 0, TRUE, 0, FALSE, 0));
> }
More information about the Devel
mailing list