Code

check_disk working with mountlist.c
[nagiosplug.git] / plugins / check_overcr.c
index 305a8242808887d103b8fdc5a7685e4760725d81..4c3b957f3a5f040637134ba1d2b6f441d1bac65b 100644 (file)
@@ -58,7 +58,7 @@
 
 #define PORT   2000
 
-#define PROGNAME "check_overcr"
+const char *progname = "check_overcr";
 
 char *server_address = NULL;
 int server_port = PORT;
@@ -317,7 +317,6 @@ process_arguments (int argc, char **argv)
 {
        int c;
 
-#ifdef HAVE_GETOPT_H
        int option_index = 0;
        static struct option long_options[] = {
                {"port", required_argument, 0, 'p'},
@@ -330,7 +329,6 @@ process_arguments (int argc, char **argv)
                {"help", no_argument, 0, 'h'},
                {0, 0, 0, 0}
        };
-#endif
 
        /* no options were supplied */
        if (argc < 2)
@@ -354,27 +352,22 @@ process_arguments (int argc, char **argv)
        }
 
        while (1) {
-#ifdef HAVE_GETOPT_H
-               c =
-                       getopt_long (argc, argv, "+hVH:t:c:w:p:v:", long_options,
+               c = getopt_long (argc, argv, "+hVH:t:c:w:p:v:", long_options,
                                                                         &option_index);
-#else
-               c = getopt (argc, argv, "+hVH:t:c:w:p:v:");
-#endif
 
                if (c == -1 || c == EOF || c == 1)
                        break;
 
                switch (c) {
                case '?':                                                                       /* print short usage statement if args not parsable */
-                       printf ("%s: Unknown argument: %s\n\n", my_basename (argv[0]), optarg);
+                       printf ("%s: Unknown argument: %s\n\n", progname, optarg);
                        print_usage ();
                        exit (STATE_UNKNOWN);
                case 'h':                                                                       /* help */
                        print_help ();
                        exit (STATE_OK);
                case 'V':                                                                       /* version */
-                       print_revision (my_basename (argv[0]), "$Revision$");
+                       print_revision (progname, "$Revision$");
                        exit (STATE_OK);
                case 'H':                                                                       /* hostname */
                        server_address = optarg;
@@ -385,7 +378,7 @@ process_arguments (int argc, char **argv)
                        else
                                terminate (STATE_UNKNOWN,
                                                                         "Server port an integer (seconds)\nType '%s -h' for additional help\n",
-                                                                        PROGNAME);
+                                                                        progname);
                        break;
                case 'v':                                                                       /* variable */
                        if (strcmp (optarg, "LOAD1") == 0)
@@ -438,7 +431,7 @@ print_usage (void)
 {
        printf
                ("Usage: %s -H host [-p port] [-v variable] [-w warning] [-c critical] [-t timeout]\n",
-                PROGNAME);
+                progname);
 }
 
 
@@ -448,7 +441,7 @@ print_usage (void)
 void
 print_help (void)
 {
-       print_revision (PROGNAME, "$Revision$");
+       print_revision (progname, "$Revision$");
        printf
                ("Copyright (c) 2000 Ethan Galstad/Karl DeBisschop\n\n"
                 "This plugin attempts to contact the Over-CR collector daemon running on the\n"