diff options
author | Benoit Mortier <opensides@users.sourceforge.net> | 2004-12-01 23:54:51 +0000 |
---|---|---|
committer | Benoit Mortier <opensides@users.sourceforge.net> | 2004-12-01 23:54:51 +0000 |
commit | d19edd4043c498626fe68308005947975ef0a697 (patch) | |
tree | 7a213ee16f9331e928b1c32aa6c521c05519db58 /plugins/check_ups.c | |
parent | 1d8128e328f714258b7fec0c62245e1d187e0439 (diff) | |
download | monitoring-plugins-d19edd4043c498626fe68308005947975ef0a697.tar.gz |
standardize localization string
standardize unknow arguments
git-svn-id: https://nagiosplug.svn.sourceforge.net/svnroot/nagiosplug/nagiosplug/trunk@969 f882894a-f735-0410-b71e-b25c423dba1c
Diffstat (limited to 'plugins/check_ups.c')
-rw-r--r-- | plugins/check_ups.c | 32 |
1 files changed, 14 insertions, 18 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c index 33cba770..7f88ec30 100644 --- a/plugins/check_ups.c +++ b/plugins/check_ups.c @@ -14,6 +14,8 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + $Id$ + ******************************************************************************/ const char *progname = "check_ups"; @@ -90,7 +92,7 @@ main (int argc, char **argv) data = strdup (""); if (process_arguments (argc, argv) != OK) - usage ("Invalid command arguments supplied\n"); + usage (_("check_ups: could not parse arguments\n")); /* initialize alarm signal handling */ signal (SIGALRM, socket_timeout_alarm_handler); @@ -287,7 +289,7 @@ determine_status (void) if (get_ups_variable ("STATUS", recv_buffer, sizeof (recv_buffer)) != STATE_OK) { - printf ("Invalid response received from hostn"); + printf ("Invalid response received from host\n"); return ERROR; } @@ -419,8 +421,6 @@ get_ups_variable (const char *varname, char *buf, size_t buflen) - - /* Command line: CHECK_UPS <host_address> [-u ups] [-p port] [-v variable] [-wv warn_value] [-cv crit_value] [-to to_sec] */ @@ -466,13 +466,15 @@ process_arguments (int argc, char **argv) switch (c) { case '?': /* help */ - usage3 ("Unknown option", optopt); + printf (_("%s: Unknown argument: %s\n\n"), progname, optarg); + print_usage (); + exit (STATE_UNKNOWN); case 'H': /* hostname */ if (is_host (optarg)) { server_address = optarg; } else { - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } break; case 'u': /* ups name */ @@ -483,7 +485,7 @@ process_arguments (int argc, char **argv) server_port = atoi (optarg); } else { - usage2 ("Server port must be a positive integer", optarg); + usage2 ("Port must be a positive integer", optarg); } break; case 'c': /* critical time threshold */ @@ -492,7 +494,7 @@ process_arguments (int argc, char **argv) check_crit = TRUE; } else { - usage2 ("Critical time must be a nonnegative integer", optarg); + usage2 ("Critical time must be a positive integer", optarg); } break; case 'w': /* warning time threshold */ @@ -501,7 +503,7 @@ process_arguments (int argc, char **argv) check_warn = TRUE; } else { - usage2 ("Warning time must be a nonnegative integer", optarg); + usage2 ("Warning time must be a positive integer", optarg); } break; case 'v': /* variable */ @@ -521,11 +523,11 @@ process_arguments (int argc, char **argv) socket_timeout = atoi (optarg); } else { - usage ("Time interval must be a nonnegative integer\n"); + usage ("Time interval must be a positive integer\n"); } break; case 'V': /* version */ - print_revision (progname, "$Revision$"); + print_revision (progname, revision); exit (STATE_OK); case 'h': /* help */ print_help (); @@ -538,7 +540,7 @@ process_arguments (int argc, char **argv) if (is_host (argv[optind])) server_address = argv[optind++]; else - usage2 (_("Invalid host name"), optarg); + usage2 (_("Invalid hostname/address"), optarg); } if (server_address == NULL) @@ -549,8 +551,6 @@ process_arguments (int argc, char **argv) - - int validate_arguments (void) { @@ -559,9 +559,6 @@ validate_arguments (void) - - - void print_help (void) { @@ -617,7 +614,6 @@ http://www.exploits.org/nut\n\n")); - void print_usage (void) { |