Removal of process_argument return code check (was Re: [Nagiosplug-checkins] nagiosplug/plugins check_by_ssh.c,1.23,1.24 check_dig.c,1.28,1.29 check_disk.c,1.48,1.49 check_dns.c,1.30,1.31 check_dummy.c,1.8,1.9 check_fping.c,1.15,1.16 check_game.c,1.11,1.12 check_hpjd.c,1.21,1.22 check_http.c,1.66,1.67 check_ide-smart.c,1.5,1.6 check_ldap.c,1.17,1.18 check_load.c,1.16,1.17 check_mrtg.c,1.14,1.15 check_mrtgtraf.c,1.14,1.15 check_mysql.c,1.15,1.16 check_nagios.c,1.12,1.13 check_nt.c,1.25,1.26 check_nwstat.c,1.16,1.17 check_overcr.c,1.9,1.10 check_pgsql.c,1.18,1.19 check_ping.c,1.29,1.30 check_procs.c,1.29,1.30 check_radius.c,1.11,1.12 check_real.c,1.14,1.15 check_smtp.c,1.29,1.30 check_snmp.c,1.39,1.40 check_ssh.c,1.16,1.17 check_swap.c,1.32,1.33 check_tcp.c,1.44,1.45 check_time.c,1.14,1.15 check_udp.c,1.13,1.14 check_ups.c,1.15,1.16 check_users.c,1.11,1.12 common.h,1.13,1.14 getaddrinfo.c,1.1,1.2 getaddrinfo.h,1.1,1.2 gethostbyname.c,1.1,1.2 gethostbyname.h,1.1,1.2 ne! gate.c! ,1.15,1.16 netutils.c,1.20,1.21 netutils.h,1.9,1.10 pop! en.c,1.7,1.8 urlize.c,1.12,1.13 utils.c,1.37,1.38 utils.h,1.19,1.20)

Benoit Mortier benoit.mortier at opensides.be
Thu Dec 2 13:09:08 CET 2004


Le jeudi 2 Décembre 2004 06:49, Ton Voon a écrit :
> Benoit,
>
> To save you a lot of translation work, I think these changes are not
>
> entirely necessary:
> >  int
> >  main (int argc, char **argv)
> >  {
> > @@ -241,7 +240,7 @@
> >   status = strdup ("");
> >
> >   if (process_arguments (argc, argv) == ERROR)
> > -  usage (_("Could not parse arguments\n"));
> > +  usage (_("check_tcp: could not parse arguments\n"));
> >
> >   /* use default expect if none listed in process_arguments() */
> >   if (EXPECT && server_expect_count == 0) {
> > @@ -389,7 +388,6 @@
> >
> >   return result;
> >  }
>
> check_tcp would not even work correctly because it could be invoked
> with check_simap or check_pop.
>
> In fact, looking through the process_arguments subroutine, it will only
> ever return OK. If it reaches an argument it doesn't like, it will exit
> out of the plugin. So the change should probably be:
>
> Index: check_tcp.c
> ===================================================================
> RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_tcp.c,v
> retrieving revision 1.46
> diff -u -r1.46 check_tcp.c
> --- check_tcp.c 2 Dec 2004 01:11:01 -0000       1.46
> +++ check_tcp.c 2 Dec 2004 05:42:10 -0000
> @@ -239,8 +239,7 @@
>          server_quit = QUIT;
>          status = strdup ("");
>
> -       if (process_arguments (argc, argv) != OK)
> -               usage (_("check_tcp: could not parse arguments\n"));
> +       process_arguments (argc, argv);
>
>          /* use default expect if none listed in process_arguments() */
>          if (EXPECT && server_expect_count == 0) {
>
> That would save lots of translations.

not that much.. and i will need a new usage4 routine for thing like this 
usage4 (_("%s: %s"), progname, optarg);

for example.. will look at this tonight

> However, this will require looking into each process_arguments
> subroutine to make sure that there is no other return code. Are you
> comfortable with this?

No i would prefer to leave that in place.

-- 
Benoit Mortier
OpenSides sprl
Linux Engineer




More information about the Commits mailing list