Code

Add newline after "Usage:" in --help
[nagiosplug.git] / plugins / check_ide_smart.c
index 14d27b33a181526206e22ec39fb706c79cae8c96..b942461b25e621b9dca005a30b40c3e5efc6c3ab 100644 (file)
@@ -1,46 +1,40 @@
-/******************************************************************************
+/*****************************************************************************
+* 
 * Nagios check_ide_smart plugin
-*
-* License: GPL
-*
-*  ide-smart 1.3 - IDE S.M.A.R.T. checking tool
-*  Copyright (C)  1998-1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>
-*                 1998      Gadi Oxman <gadio@netvision.net.il>
+* ide-smart 1.3 - IDE S.M.A.R.T. checking tool
 * 
+* License: GPL
+* Copyright (C) 1998-1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>
+*               1998      Gadi Oxman <gadio@netvision.net.il>
 * Copyright (c) 2000 Robert Dale <rdale@digital-mission.com>
-* Copyright (c) 2000-2006 nagios-plugins team
-*
-* Last Modified: $Date$
-*
+* Copyright (c) 2000-2007 Nagios Plugins Development Team
+* 
 * Description:
-*
+* 
 * This file contains the check_ide_smart plugin
-*
-*  This plugin checks a local hard drive with the (Linux specific) SMART interface
-*
-*
-* License Information:
-*
-* This program is free software; you can redistribute it and/or modify
+* 
+* This plugin checks a local hard drive with the (Linux specific) SMART
+* interface
+* 
+* 
+* This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
-* the Free Software Foundation; either version 2 of the License, or
+* the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
-*
+* 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
-*
+* 
 * You should have received a copy of the GNU General Public License
-* along with this program; if not, write to the Free Software
-* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- * $Id$
- */
+* along with this program.  If not, see <http://www.gnu.org/licenses/>.
+* 
+* 
+*****************************************************************************/
 
 const char *progname = "check_ide_smart";
-const char *revision = "$Revision$";
-const char *copyright = "2000-2006";
+const char *copyright = "1998-2007";
 const char *email = "nagiosplug-devel@lists.sourceforge.net";
        
 #include "common.h"
@@ -172,9 +166,13 @@ main (int argc, char *argv[])
                {"auto-off", no_argument, 0, '0'}, 
                {"nagios", no_argument, 0, 'n'}, 
                {"help", no_argument, 0, 'h'}, 
-               {"version", no_argument, 0, 'V'}, {0, 0, 0, 0} 
+               {"version", no_argument, 0, 'V'},
+               {0, 0, 0, 0}
        };
 
+       /* Parse extra opts if any */
+       argv=np_extra_opts (&argc, argv, progname);
+
        setlocale (LC_ALL, "");
        bindtextdomain (PACKAGE, LOCALEDIR);
        textdomain (PACKAGE);
@@ -209,10 +207,10 @@ main (int argc, char *argv[])
                        print_help ();
                        return STATE_OK;
                case 'V':
-                       print_revision (progname, revision);
+                       print_revision (progname, NP_VERSION);
                        return STATE_OK;
                default:
-                       usage2 (_("Unknown argument"), optarg);
+                       usage5 ();
                }
        }
 
@@ -437,23 +435,6 @@ print_values (values_t * p, thresholds_t * t)
 }
 
 
-
-void
-print_thresholds (thresholds_t * p) 
-{
-       threshold_t * threshold = p->thresholds;
-       int i;
-       printf ("\n");
-       printf ("SmartRevision=%d\n", p->revision);
-       for (i = 0; i < NR_ATTRIBUTES; i++) {
-               if (threshold->id) {
-                       printf ("Id=%3d, Threshold=%3d\n", threshold->id,
-                                                       threshold->threshold); }
-               ++threshold;
-       }
-       printf ("CheckSum=%d\n", p->checksum);
-}
-
 int
 smart_cmd_simple (int fd, enum SmartCommand command, __u8 val0, char show_error) 
 {
@@ -496,20 +477,21 @@ smart_read_thresholds (int fd, thresholds_t * thresholds)
 void
 print_help (void)
 {
-       print_revision (progname, revision);
+       print_revision (progname, NP_VERSION);
 
        printf ("Nagios feature - 1999 Robert Dale <rdale@digital-mission.com>\n");
        printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar@lightside.dhis.org>\n");
        printf (COPYRIGHT, copyright, email);
 
        printf (_("This plugin checks a local hard drive with the (Linux specific) SMART interface [http://smartlinux.sourceforge.net/smart/index.php]."));
+
   printf ("\n\n");
-  
+
   print_usage ();
 
-  printf (_(UT_HELP_VRSN));
-       
+  printf (UT_HELP_VRSN);
+  printf (UT_EXTRA_OPTS);
+
   printf (" %s\n", "-d, --device=DEVICE");
   printf ("    %s\n", _("Select device DEVICE"));
   printf ("    %s\n", _("Note: if the device is selected with this option, _no_ other options are accepted"));
@@ -522,8 +504,9 @@ print_help (void)
   printf (" %s\n", "-0, --auto-off");
   printf ("    %s\n", _("Turn off automatic offline tests"));
   printf (" %s\n", "-n, --nagios");
-  printf ("    %s\n", _("Output suitable for Nagios\n"));
-  printf (_(UT_SUPPORT));
+  printf ("    %s\n", _("Output suitable for Nagios"));
+
+  printf (UT_SUPPORT);
 }
 
  /* todo : add to the long nanual as example
@@ -541,7 +524,7 @@ print_help (void)
 void
 print_usage (void)
 {
-       printf (_("Usage:");
+  printf ("%s\n", _("Usage:"));
   printf ("%s [-d <device>] [-i <immediate>] [-q quiet] [-1 <auto-on>]",progname);
-  pritnf (" [-O <auto-off>] [-n <nagios>]\n");
+  printf (" [-O <auto-off>] [-n <nagios>]\n");
 }