Code

still trying to fix #1094326
[nagiosplug.git] / plugins / check_nwstat.c
index ce5773b9dbbdb87c770bee6e4464516004d7143c..601b25d32178004370c01f0a74d2baa3122f6772 100644 (file)
@@ -20,7 +20,7 @@
 
 const char *progname = "check_nwstat";
 const char *revision = "$Revision$";
-const char *copyright = "2000-2003";
+const char *copyright = "2000-2004";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
 #include "common.h"
@@ -84,7 +84,7 @@ void print_usage(void);
 
 int
 main(int argc, char **argv) {
-       int result;
+       int result = STATE_UNKNOWN;
        int sd;
        char *send_buffer=NULL;
        char recv_buffer[MAX_INPUT_BUFFER];
@@ -121,7 +121,7 @@ main(int argc, char **argv) {
        bindtextdomain (PACKAGE, LOCALEDIR);
        textdomain (PACKAGE);
 
-       if (process_arguments(argc,argv) != TRUE)
+       if (process_arguments(argc,argv) == ERROR)
                usage4 (_("Could not parse arguments"));
 
        /* initialize alarm signal handling */
@@ -643,7 +643,7 @@ main(int argc, char **argv) {
                        result=STATE_CRITICAL;
                else if (check_warning_value==TRUE && dirty_cache_buffers <= warning_value)
                        result=STATE_WARNING;
-               asprintf (&output_message,_("dirty cache buffers = %lu%% of the total"),dirty_cache_buffers);
+               asprintf (&output_message,_("Dirty cache buffers = %lu%% of the total"),dirty_cache_buffers);
 
                /* check % total cache buffers as a percentage of the original*/
        } else if (vars_to_check==TCB) {
@@ -658,7 +658,7 @@ main(int argc, char **argv) {
                        result=STATE_CRITICAL;
                else if (check_warning_value==TRUE && total_cache_buffers <= warning_value)
                        result=STATE_WARNING;
-               asprintf (&output_message,_("total cache buffers = %lu%% of the original"),total_cache_buffers);
+               asprintf (&output_message,_("Total cache buffers = %lu%% of the original"),total_cache_buffers);
                
        } else if (vars_to_check==DSVER) {
                asprintf (&send_buffer,"S13\r\n");
@@ -760,9 +760,7 @@ int process_arguments(int argc, char **argv) {
                switch (c)
                        {
                        case '?': /* print short usage statement if args not parsable */
-                               printf ("%s: Unknown argument: %s\n\n", progname, optarg);
-                               print_usage();
-                               exit(STATE_UNKNOWN);
+                       usage2 (_("Unknown argument"), optarg);
                        case 'h': /* help */
                                print_help();
                                exit(STATE_OK);
@@ -779,7 +777,7 @@ int process_arguments(int argc, char **argv) {
                                if (is_intnonneg(optarg))
                                        server_port=atoi(optarg);
                                else
-                                       die(STATE_UNKNOWN,_("Server port an integer (seconds)\nType '%s -h' for additional help\n"),progname);
+                                       die(STATE_UNKNOWN,_("Server port an integer\n"));
                                break;
                        case 'v':
                                if (strlen(optarg)<3)
@@ -908,9 +906,8 @@ void print_help(void)
        printf (COPYRIGHT, copyright, email);
 
        printf (_("\
-Usage: %s This plugin attempts to contact the MRTGEXT NLM running\n\
-on a Novell server to gather the requested system information.\n\n"),
-               progname);
+This plugin attempts to contact the MRTGEXT NLM running on a\n\
+Novell server to gather the requested system information.\n\n"));
 
        print_usage();
 
@@ -987,8 +984,7 @@ Notes:\n\
 
 void print_usage(void)
 {
-       printf (_("\
+       printf ("\
 Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical]\n\
-  [-t timeout].\n"), progname);
-       printf (_(UT_HLP_VRS), progname, progname);
+                    [-t timeout].\n", progname);
 }