[Nagiosplug-checkins] nagiosplug/plugins check_ide_smart.c,1.7,1.8

Stanley Hopcroft stanleyhopcroft at users.sourceforge.net
Tue Jan 25 14:16:02 CET 2005


Update of /cvsroot/nagiosplug/nagiosplug/plugins
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16820

Modified Files:
	check_ide_smart.c 
Log Message:
Display usage if no argv (Reuben Farrelly)

Index: check_ide_smart.c
===================================================================
RCS file: /cvsroot/nagiosplug/nagiosplug/plugins/check_ide_smart.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- check_ide_smart.c	25 Jan 2005 12:43:45 -0000	1.7
+++ check_ide_smart.c	25 Jan 2005 22:15:00 -0000	1.8
@@ -181,11 +181,14 @@
 	while (1) {
 		
 		o = getopt_long (argc, argv, "+d:iq10nhV", longopts, &longindex);
-		
-		if (o == -1 || o == EOF)
-			break;
 
 		switch (o) {
+		case -1: 
+								/* 
+								 * bail out of the switch but not the loop, so
+								 * that device can be extracted from argv.
+								 */
+			break;
 		case 'd':
 			device = optarg;
 			break;
@@ -226,7 +229,7 @@
 		fd = open (device, O_RDONLY);
 
 		if (fd < 0) {
-			printf (_("CRITICAL - Couldn't open device: %s\n"), strerror (errno));
+			printf (_("CRITICAL - Couldn't open device %s: %s\n"), device, strerror (errno));
 			return 2;
 		}
 
@@ -498,12 +501,13 @@
 	printf ("(C) 1999 Ragnar Hojland Espinosa <ragnar at lightside.dhis.org>\n");
 	printf (COPYRIGHT, copyright, email);
 
-	printf(_("This plugin checks this host's IDE hard drive through the (Linux specific) SMART command interface.\n\n"));
+	printf(_("This plugin checks a local hard drive with the (Linux specific) SMART interface [http://smartlinux.sourceforge.net/smart/index.php].\n\n"));
 	
 	printf ("\
-Usage: %s [DEVICE] [OPTION]\n\
+Usage: %s [OPTION] [DEVICE]\n\
  -d, --device=DEVICE\n\
     Select device DEVICE\n\
+    Note: if the device is selected with this option, _no_ other options are accepted\n\
  -i, --immediate\n\
     Perform immediately offline tests\n\
  -q, --quiet-check\n\





More information about the Commits mailing list