summaryrefslogtreecommitdiffstats
path: root/plugins/check_ups.c
diff options
context:
space:
mode:
authorBenoit Mortier <opensides@users.sourceforge.net>2004-12-01 23:54:51 (GMT)
committerBenoit Mortier <opensides@users.sourceforge.net>2004-12-01 23:54:51 (GMT)
commitd19edd4043c498626fe68308005947975ef0a697 (patch)
tree7a213ee16f9331e928b1c32aa6c521c05519db58 /plugins/check_ups.c
parent1d8128e328f714258b7fec0c62245e1d187e0439 (diff)
downloadmonitoring-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.c32
1 files changed, 14 insertions, 18 deletions
diff --git a/plugins/check_ups.c b/plugins/check_ups.c
index 33cba77..7f88ec3 100644
--- a/plugins/check_ups.c
+++ b/plugins/check_ups.c
@@ -14,6 +14,8 @@
14 along with this program; if not, write to the Free Software 14 along with this program; if not, write to the Free Software
15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 15 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16 16
17 $Id$
18
17******************************************************************************/ 19******************************************************************************/
18 20
19const char *progname = "check_ups"; 21const char *progname = "check_ups";
@@ -90,7 +92,7 @@ main (int argc, char **argv)
90 data = strdup (""); 92 data = strdup ("");
91 93
92 if (process_arguments (argc, argv) != OK) 94 if (process_arguments (argc, argv) != OK)
93 usage ("Invalid command arguments supplied\n"); 95 usage (_("check_ups: could not parse arguments\n"));
94 96
95 /* initialize alarm signal handling */ 97 /* initialize alarm signal handling */
96 signal (SIGALRM, socket_timeout_alarm_handler); 98 signal (SIGALRM, socket_timeout_alarm_handler);
@@ -287,7 +289,7 @@ determine_status (void)
287 289
288 if (get_ups_variable ("STATUS", recv_buffer, sizeof (recv_buffer)) != 290 if (get_ups_variable ("STATUS", recv_buffer, sizeof (recv_buffer)) !=
289 STATE_OK) { 291 STATE_OK) {
290 printf ("Invalid response received from hostn"); 292 printf ("Invalid response received from host\n");
291 return ERROR; 293 return ERROR;
292 } 294 }
293 295
@@ -419,8 +421,6 @@ get_ups_variable (const char *varname, char *buf, size_t buflen)
419 421
420 422
421 423
422
423
424/* Command line: CHECK_UPS <host_address> [-u ups] [-p port] [-v variable] 424/* Command line: CHECK_UPS <host_address> [-u ups] [-p port] [-v variable]
425 [-wv warn_value] [-cv crit_value] [-to to_sec] */ 425 [-wv warn_value] [-cv crit_value] [-to to_sec] */
426 426
@@ -466,13 +466,15 @@ process_arguments (int argc, char **argv)
466 466
467 switch (c) { 467 switch (c) {
468 case '?': /* help */ 468 case '?': /* help */
469 usage3 ("Unknown option", optopt); 469 printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
470 print_usage ();
471 exit (STATE_UNKNOWN);
470 case 'H': /* hostname */ 472 case 'H': /* hostname */
471 if (is_host (optarg)) { 473 if (is_host (optarg)) {
472 server_address = optarg; 474 server_address = optarg;
473 } 475 }
474 else { 476 else {
475 usage2 (_("Invalid host name"), optarg); 477 usage2 (_("Invalid hostname/address"), optarg);
476 } 478 }
477 break; 479 break;
478 case 'u': /* ups name */ 480 case 'u': /* ups name */
@@ -483,7 +485,7 @@ process_arguments (int argc, char **argv)
483 server_port = atoi (optarg); 485 server_port = atoi (optarg);
484 } 486 }
485 else { 487 else {
486 usage2 ("Server port must be a positive integer", optarg); 488 usage2 ("Port must be a positive integer", optarg);
487 } 489 }
488 break; 490 break;
489 case 'c': /* critical time threshold */ 491 case 'c': /* critical time threshold */
@@ -492,7 +494,7 @@ process_arguments (int argc, char **argv)
492 check_crit = TRUE; 494 check_crit = TRUE;
493 } 495 }
494 else { 496 else {
495 usage2 ("Critical time must be a nonnegative integer", optarg); 497 usage2 ("Critical time must be a positive integer", optarg);
496 } 498 }
497 break; 499 break;
498 case 'w': /* warning time threshold */ 500 case 'w': /* warning time threshold */
@@ -501,7 +503,7 @@ process_arguments (int argc, char **argv)
501 check_warn = TRUE; 503 check_warn = TRUE;
502 } 504 }
503 else { 505 else {
504 usage2 ("Warning time must be a nonnegative integer", optarg); 506 usage2 ("Warning time must be a positive integer", optarg);
505 } 507 }
506 break; 508 break;
507 case 'v': /* variable */ 509 case 'v': /* variable */
@@ -521,11 +523,11 @@ process_arguments (int argc, char **argv)
521 socket_timeout = atoi (optarg); 523 socket_timeout = atoi (optarg);
522 } 524 }
523 else { 525 else {
524 usage ("Time interval must be a nonnegative integer\n"); 526 usage ("Time interval must be a positive integer\n");
525 } 527 }
526 break; 528 break;
527 case 'V': /* version */ 529 case 'V': /* version */
528 print_revision (progname, "$Revision$"); 530 print_revision (progname, revision);
529 exit (STATE_OK); 531 exit (STATE_OK);
530 case 'h': /* help */ 532 case 'h': /* help */
531 print_help (); 533 print_help ();
@@ -538,7 +540,7 @@ process_arguments (int argc, char **argv)
538 if (is_host (argv[optind])) 540 if (is_host (argv[optind]))
539 server_address = argv[optind++]; 541 server_address = argv[optind++];
540 else 542 else
541 usage2 (_("Invalid host name"), optarg); 543 usage2 (_("Invalid hostname/address"), optarg);
542 } 544 }
543 545
544 if (server_address == NULL) 546 if (server_address == NULL)
@@ -549,8 +551,6 @@ process_arguments (int argc, char **argv)
549 551
550 552
551 553
552
553
554int 554int
555validate_arguments (void) 555validate_arguments (void)
556{ 556{
@@ -559,9 +559,6 @@ validate_arguments (void)
559 559
560 560
561 561
562
563
564
565void 562void
566print_help (void) 563print_help (void)
567{ 564{
@@ -617,7 +614,6 @@ http://www.exploits.org/nut\n\n"));
617 614
618 615
619 616
620
621void 617void
622print_usage (void) 618print_usage (void)
623{ 619{