Code

check_dns needs a space between 'time' and the hostname
[nagiosplug.git] / plugins / check_disk.c
index c823925011cd4cffa089357be374da46dd8de930..669a1cd6b1fd62d9488b887a3e748f08a9288da1 100644 (file)
  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_disk";
 const char *program_name = "check_disk";       // Required for coreutils libs
 const char *revision = "$Revision$";
-const char *copyright = "1999-2003";
+const char *copyright = "1999-2004";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
 
 #include "common.h"
@@ -133,7 +135,7 @@ int display_mntp = FALSE;
 static struct mount_entry *mount_list;
 
 
-\f
+
 int
 main (int argc, char **argv)
 {
@@ -161,8 +163,8 @@ main (int argc, char **argv)
 
        mount_list = read_filesystem_list (0);
 
-       if (process_arguments (argc, argv) != OK)
-               usage (_("Could not parse arguments\n"));
+       if (process_arguments (argc, argv) == ERROR)
+               usage4 (_("Could not parse arguments"));
 
        for (me = mount_list; me; me = me->me_next) {
 
@@ -240,7 +242,6 @@ main (int argc, char **argv)
 
 
 
-\f
 /* process command-line arguments */
 int
 process_arguments (int argc, char **argv)
@@ -321,7 +322,7 @@ process_arguments (int argc, char **argv)
                                break;
                        }
                        else {
-                               usage (_("Warning threshold must be integer or percentage!\n"));
+                               usage4 (_("Warning threshold must be integer or percentage!"));
                        }
                case 'c':                                                                       /* critical threshold */
                        if (is_intnonneg (optarg)) {
@@ -338,7 +339,7 @@ process_arguments (int argc, char **argv)
                                break;
                        }
                        else {
-                               usage (_("Critical threshold must be integer or percentage!\n"));
+                               usage4 (_("Critical threshold must be integer or percentage!"));
                        }
                case 'u':
                        if (units)
@@ -437,8 +438,9 @@ process_arguments (int argc, char **argv)
                        print_help ();
                        exit (STATE_OK);
                case '?':                                                                       /* help */
-                       usage (_("Unknow argument\n"));
-                       break;
+                       printf (_("%s: Unknown argument: %s\n\n"), progname, optarg);
+                       print_usage ();
+                       exit (STATE_UNKNOWN);
                }
        }
 
@@ -479,6 +481,7 @@ process_arguments (int argc, char **argv)
 }
 
 
+
 void
 print_path (const char *mypath) 
 {
@@ -490,6 +493,8 @@ print_path (const char *mypath)
        return;
 }
 
+
+
 int
 validate_arguments (uintmax_t w, uintmax_t c, double wp, double cp, char *mypath)
 {
@@ -523,7 +528,6 @@ INPUT ERROR: C_DF (%lu) should be less than W_DF (%lu) and both should be greate
 
 
 
-\f
 int
 check_disk (double usp, double free_disk)
 {
@@ -564,8 +568,6 @@ walk_name_list (struct name_list *list, const char *name)
 
 
 
-
-
 void
 print_help (void)
 {
@@ -576,7 +578,7 @@ print_help (void)
 
        printf (_("\
 This plugin checks the amount of used disk space on a mounted file system\n\
-and generates an alert if free space is less than one of the threshold values."));
+and generates an alert if free space is less than one of the threshold values.\n\n"));
 
        print_usage ();
 
@@ -631,14 +633,10 @@ and generates an alert if free space is less than one of the threshold values.")
 
 
 
-
 void
 print_usage (void)
 {
-       printf (_("\
+       printf ("\
 Usage: %s -w limit -c limit [-p path | -x device] [-t timeout] [-m] [-e]\n\
-        [-v] [-q]\n\
-       %s (-h|--help)\n\
-       %s (-V|--version)\n"),
-               progname,  progname, progname);
+                  [-v] [-q]\n", progname);
 }