[Nagiosplug-devel] Re: ngettext errors with --disable-nls (was Re: [Nagiosplug-devel] check_procs, check_ldap compile errors)

Andreas Ericsson ae at op5.se
Fri Dec 10 00:23:02 CET 2004


Ton Voon wrote:
> Andreas,
> 
> Just to let you know that I've worked out why ngettext was failing, so 
> it is now fixed. I've reverted back the ngettext changes that you have 
> suggested patches for. A compile with or without --disable-nls works now.
> 

I noticed (the rollback). Is it wise to use ngettext for floating point 
though?

> Ton
> 
> On 3 Dec 2004, at 09:00, Ton Voon wrote:
> 
>> 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));
>>>      }
>>
>>
> 
> 
> 
> -------------------------------------------------------
> SF email is sponsored by - The IT Product Guide
> Read honest & candid reviews on hundreds of IT Products from real users.
> Discover which products truly live up to the hype. Start reading now. 
> http://productguide.itmanagersjournal.com/
> _______________________________________________________
> Nagios Plugin Development Mailing List 
> Nagiosplug-devel at lists.sourceforge.net
> Unsubscribe at 
> https://lists.sourceforge.net/lists/listinfo/nagiosplug-devel
> ::: Please include plugins version (-v) and OS when reporting any issue. 
> ::: Messages without supporting info will risk being sent to /dev/null
> 

-- 
Andreas Ericsson                   andreas.ericsson at op5.se
OP5 AB                             www.op5.se
Lead Developer




More information about the Devel mailing list