Code

Removed old terminate function (Bug 1093491)
[nagiosplug.git] / plugins / check_fping.c
index 817d647aa4aa14757a49647b13a657cf4f0d2e49..5ffcd16e35ed3a02bcc9fafd61b7b0774720ba33 100644 (file)
@@ -20,7 +20,7 @@
 
 const char *progname = "check_fping";
 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"
@@ -57,6 +57,8 @@ int wrta_p = FALSE;
 int
 main (int argc, char **argv)
 {
+/* normaly should be   int result = STATE_UNKNOWN; */
+
        int status = STATE_UNKNOWN;
        char *server = NULL;
        char *command_line = NULL;
@@ -67,7 +69,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"));
 
        server = strscpy (server, server_name);
@@ -240,9 +242,7 @@ 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);
@@ -299,15 +299,13 @@ process_arguments (int argc, char **argv)
                }
        }
 
-
        if (server_name == NULL)
-               usage (_("Hostname was not supplied\n\n"));
+               usage4 (_("Hostname was not supplied"));
 
        return OK;
 }
 
 
-
 int
 get_threshold (char *arg, char *rv[2])
 {
@@ -349,20 +347,19 @@ get_threshold (char *arg, char *rv[2])
 }
 
 
-
 void
 print_help (void)
 {
 
-       print_revision (progname, "$Revision$");
+       print_revision (progname, revision);
 
        printf ("Copyright (c) 1999 Didi Rieder <adrieder@sbox.tu-graz.ac.at>\n");
        printf (COPYRIGHT, copyright, email);
 
        printf (_("\
-This plugin will use the /bin/fping command (from saint) to ping the\n\
-specified host for a fast check if the host is alive. Note that it is\n\
-necessary to set the suid flag on fping.\n\n"));
+This plugin will use the /bin/fping command to ping the specified host\n\
+for a fast check if the host is alive.\n\
+Note that it is necessary to set the suid flag on fping.\n\n"));
 
        print_usage ();
 
@@ -393,10 +390,8 @@ percentage of packet loss to trigger an alarm state.\n"));
 }
 
 
-
 void
 print_usage (void)
 {
-       printf (_("Usage: %s <host_address>\n"), progname);
-       printf (_(UT_HLP_VRS), progname, progname);
+       printf ("Usage: %s <host_address>\n", progname);
 }