diff --git a/sm5/Makefile b/sm5/Makefile
index 994316e08a71c853c38c50a8267dfe0da48ef682..57400cf1a9bad9fd0065dc85df6b9a20147e6bea 100644
--- a/sm5/Makefile
+++ b/sm5/Makefile
@@ -2,7 +2,7 @@
 #
 # Home page: http://smartmontools.sourceforge.net
 #
-# $Id: Makefile,v 1.21 2002/10/24 07:50:45 ballen4705 Exp $
+# $Id: Makefile,v 1.22 2002/10/24 09:54:02 ballen4705 Exp $
 #
 # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 # 
@@ -42,28 +42,28 @@ pkgname2=$(pkgname)-$(counter)
 
 all: smartd smartctl
 
-smartctl: atacmds.o scsicmds.o smartctl.c smartctl.h ataprint.o scsiprint.o atacmds.h ataprint.h scsicmds.h scsiprint.h VERSION
-	${CC} -DSMARTMONTOOLS_VERSION=$(counter) -o smartctl ${CFLAGS} atacmds.o scsicmds.o ataprint.o smartctl.c scsiprint.o
+smartctl: atacmds.o scsicmds.o smartctl.c smartctl.h ataprint.o scsiprint.o atacmds.h ataprint.h scsicmds.h scsiprint.h VERSION Makefile
+	${CC} -DSMARTMONTOOLS_VERSION=$(counter) -o smartctl ${CFLAGS} smartctl.c atacmds.o scsicmds.o ataprint.o scsiprint.o
 
-smartd:  atacmds.o scsicmds.o smartd.c smartd.h atacmds.h scsicmds.h VERSION
-	${CC} -DSMARTMONTOOLS_VERSION=$(counter) -o smartd ${CFLAGS} scsicmds.o atacmds.o smartd.c
+smartd:  atacmds.o scsicmds.o smartd.c smartd.h atacmds.h scsicmds.h VERSION Makefile
+	${CC} -DSMARTMONTOOLS_VERSION=$(counter) -o smartd ${CFLAGS} smartd.c scsicmds.o atacmds.o
 
-ataprint.o: atacmds.o ataprint.h ataprint.c smartctl.h extern.h
-	${CC} ${CFLAGS} -c ataprint.c
-
-scsiprint.o: scsiprint.h scsiprint.c scsicmds.o smartctl.h extern.h scsicmds.h
-	${CC} ${CFLAGS} -c scsiprint.c 
-
-atacmds.o: atacmds.h atacmds.c
+atacmds.o: atacmds.h atacmds.c Makefile
 	${CC} ${CFLAGS} -c atacmds.c 
 
-scsicmds.o: scsicmds.h scsicmds.c 
+ataprint.o: atacmds.o ataprint.h ataprint.c smartctl.h extern.h Makefile
+	${CC} ${CFLAGS} -c ataprint.c
+
+scsicmds.o: scsicmds.h scsicmds.c Makefile
 	${CC} ${CFLAGS} -c scsicmds.c
 
+scsiprint.o: scsiprint.h scsiprint.c scsicmds.o smartctl.h extern.h scsicmds.h Makefile
+	${CC} ${CFLAGS} -c scsiprint.c 
+
 clean:
 	rm -f *.o smartctl smartd *~ \#*\# smartmontools*.tar.gz smartmontools*.rpm temp.*
 
-install: smartctl smartd smartctl.8 smartd.8 smartd.initd
+install: smartctl smartd smartctl.8 smartd.8 smartd.initd Makefile
 	install -m 755 -o root -g root -D smartctl $(DESTDIR)/usr/sbin/smartctl
 	install -m 755 -o root -g root -D smartd $(DESTDIR)/usr/sbin/smartd
 	install -m 644 -o root -g root -D smartctl.8 $(DESTDIR)/usr/share/man/man8/smartctl.8
@@ -72,7 +72,7 @@ install: smartctl smartd smartctl.8 smartd.8 smartd.initd
 	echo "To manually start smartd on bootup, run /etc/rc.d/init.d/smartd start"
 	echo "To Automatically start smartd on bootup, run /sbin/chkconfig --add smartd"
 
-uninstall:
+uninstall: Makefile
 	rm -f /usr/sbin/smartctl /usr/sbin/smartd /usr/share/man/man8/smartctl.8 /usr/share/man/man8/smartd.8\
            /usr/share/man/man8/smartctl.8.gz /usr/share/man/man8/smartd.8.gz
 	/sbin/chkconfig --del smartd
diff --git a/sm5/atacmds.c b/sm5/atacmds.c
index cb93596fad77f97c2e955fd8a681907089b38391..a3a6f35a6c5894d5e1c4547660aecc5c0a8ccc21 100644
--- a/sm5/atacmds.c
+++ b/sm5/atacmds.c
@@ -29,7 +29,7 @@
 #include <errno.h>
 #include "atacmds.h"
 
-const char *CVSid1="$Id: atacmds.c,v 1.21 2002/10/23 20:36:59 ballen4705 Exp $" CVSID1;
+const char *CVSid1="$Id: atacmds.c,v 1.22 2002/10/24 09:54:02 ballen4705 Exp $" CVSID1;
 
 // These Drive Identity tables are taken from hdparm 5.2, and are also
 // given in the ATA/ATAPI specs for the IDENTIFY DEVICE command.  Note
@@ -641,3 +641,112 @@ int ataCheckSmart (struct ata_smart_values data,
   }
   return 0;
 }
+
+
+// Note some attribute names appear redundant because different
+// manufacturers use different attribute IDs for an attribute with the
+// same name.
+void ataPrintSmartAttribName(char *out, unsigned char id){
+  char *name;
+  switch (id){
+    
+  case 1:
+    name="Raw_Read_Error_Rate";
+    break;
+  case 2:
+    name="Throughput_Performance";
+    break;
+  case 3:
+    name="Spin_Up_Time";
+    break;
+  case 4:
+    name="Start_Stop_Count";
+    break;
+  case 5:
+    name="Reallocated_Sector_Ct";
+    break;
+  case 6:
+    name="Read_Channel_Margin";
+    break;
+  case 7:
+    name="Seek_Error_Rate";
+    break;
+  case 8:
+    name="Seek_Time_Performance";
+    break;
+  case 9:
+    name="Power_On_Hours";
+    break;
+  case 10:
+    name="Spin_Retry_Count";
+    break;
+  case 11:
+    name="Calibration_Retry_Count";
+    break;
+  case 12:
+    name="Power_Cycle_Count";
+    break;
+  case 13:
+    name="Read_Soft_Error_Rate";
+    break;
+  case 191:
+    name="G-Sense_Error_Rate";
+    break;
+  case 192:
+    name="Power-Off_Retract_Count";
+    break;
+  case 193:
+    name="Load_Cycle_Count";
+    break;
+  case 194:
+    name="Temperature_Centigrade";
+    break;
+  case 195:
+    name="Hardware_ECC_Recovered";
+    break;
+  case 196:
+    name="Reallocated_Event_Count";
+    break;
+  case 197:
+    name="Current_Pending_Sector";
+    break;
+  case 198:
+    name="Offline_Uncorrectable";
+    break;
+  case 199:
+    name="UDMA_CRC_Error_Count";
+    break;
+  case 220:
+    name="Disk_Shift";
+    break;
+  case 221:
+    name="G-Sense_Error_Rate";
+    break;
+  case 222:
+    name="Loaded_Hours";
+    break;
+  case 223:
+    name="Load_Retry_Count";
+    break;
+  case 224:
+    name="Load_Friction";
+    break;
+  case 225:
+    name="Load_Cycle_Count";
+    break;
+  case 226:
+    name="Load-in_Time";
+    break;
+  case 227:
+    name="Torq-amp_Count";
+    break;
+  case 228:
+    name="Power-off_Retract_Count";
+    break;
+  default:
+    name="Unknown_Attribute";
+    break;
+  }
+  sprintf(out,"%3d %s",id,name);
+  return;
+}
diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp
index 880509c6c3785d2d1dc68e8c235ef54464bc0ce9..655e3b5acdfb6e5bed0a5e8bbe635ddd04a18b48 100644
--- a/sm5/atacmds.cpp
+++ b/sm5/atacmds.cpp
@@ -29,7 +29,7 @@
 #include <errno.h>
 #include "atacmds.h"
 
-const char *CVSid1="$Id: atacmds.cpp,v 1.21 2002/10/23 20:36:59 ballen4705 Exp $" CVSID1;
+const char *CVSid1="$Id: atacmds.cpp,v 1.22 2002/10/24 09:54:02 ballen4705 Exp $" CVSID1;
 
 // These Drive Identity tables are taken from hdparm 5.2, and are also
 // given in the ATA/ATAPI specs for the IDENTIFY DEVICE command.  Note
@@ -641,3 +641,112 @@ int ataCheckSmart (struct ata_smart_values data,
   }
   return 0;
 }
+
+
+// Note some attribute names appear redundant because different
+// manufacturers use different attribute IDs for an attribute with the
+// same name.
+void ataPrintSmartAttribName(char *out, unsigned char id){
+  char *name;
+  switch (id){
+    
+  case 1:
+    name="Raw_Read_Error_Rate";
+    break;
+  case 2:
+    name="Throughput_Performance";
+    break;
+  case 3:
+    name="Spin_Up_Time";
+    break;
+  case 4:
+    name="Start_Stop_Count";
+    break;
+  case 5:
+    name="Reallocated_Sector_Ct";
+    break;
+  case 6:
+    name="Read_Channel_Margin";
+    break;
+  case 7:
+    name="Seek_Error_Rate";
+    break;
+  case 8:
+    name="Seek_Time_Performance";
+    break;
+  case 9:
+    name="Power_On_Hours";
+    break;
+  case 10:
+    name="Spin_Retry_Count";
+    break;
+  case 11:
+    name="Calibration_Retry_Count";
+    break;
+  case 12:
+    name="Power_Cycle_Count";
+    break;
+  case 13:
+    name="Read_Soft_Error_Rate";
+    break;
+  case 191:
+    name="G-Sense_Error_Rate";
+    break;
+  case 192:
+    name="Power-Off_Retract_Count";
+    break;
+  case 193:
+    name="Load_Cycle_Count";
+    break;
+  case 194:
+    name="Temperature_Centigrade";
+    break;
+  case 195:
+    name="Hardware_ECC_Recovered";
+    break;
+  case 196:
+    name="Reallocated_Event_Count";
+    break;
+  case 197:
+    name="Current_Pending_Sector";
+    break;
+  case 198:
+    name="Offline_Uncorrectable";
+    break;
+  case 199:
+    name="UDMA_CRC_Error_Count";
+    break;
+  case 220:
+    name="Disk_Shift";
+    break;
+  case 221:
+    name="G-Sense_Error_Rate";
+    break;
+  case 222:
+    name="Loaded_Hours";
+    break;
+  case 223:
+    name="Load_Retry_Count";
+    break;
+  case 224:
+    name="Load_Friction";
+    break;
+  case 225:
+    name="Load_Cycle_Count";
+    break;
+  case 226:
+    name="Load-in_Time";
+    break;
+  case 227:
+    name="Torq-amp_Count";
+    break;
+  case 228:
+    name="Power-off_Retract_Count";
+    break;
+  default:
+    name="Unknown_Attribute";
+    break;
+  }
+  sprintf(out,"%3d %s",id,name);
+  return;
+}
diff --git a/sm5/atacmds.h b/sm5/atacmds.h
index 8e3a612a7a527607cfb7fc0500fa6491df02b786..a55cf89ea6058c8f1bdf146b2a8ce35846a2c122 100644
--- a/sm5/atacmds.h
+++ b/sm5/atacmds.h
@@ -26,7 +26,7 @@
 #define _ATACMDS_H_
 
 #ifndef CVSID1
-#define CVSID1 "$Id: atacmds.h,v 1.17 2002/10/23 12:24:24 ballen4705 Exp $\n"
+#define CVSID1 "$Id: atacmds.h,v 1.18 2002/10/24 09:54:02 ballen4705 Exp $\n"
 #endif
 
 // These are the major and minor versions for smartd and smartctl
@@ -373,6 +373,10 @@ int ataSmartTest(int device, int testtype);
 
 int TestTime(struct ata_smart_values data,int testtype);
 
+// Prints Attribute Name for standard SMART attributes. Writes a
+// 30 byte string with attribute name into output
+void ataPrintSmartAttribName(char *output, unsigned char id);
+
 // like printf() except that we can control it better....
 void pout(char *fmt, ...);
 
diff --git a/sm5/ataprint.c b/sm5/ataprint.c
index aeb221a365b59b291c03dc8ec2bc598d00251dd7..6bc3d385f1db1871ed9380f812e8592559cf9a3d 100644
--- a/sm5/ataprint.c
+++ b/sm5/ataprint.c
@@ -28,7 +28,7 @@
 #include "smartctl.h"
 #include "extern.h"
 
-const char *CVSid4="$Id: ataprint.c,v 1.32 2002/10/24 08:46:03 ballen4705 Exp $"
+const char *CVSid4="$Id: ataprint.c,v 1.33 2002/10/24 09:54:02 ballen4705 Exp $"
 CVSID2 CVSID3 CVSID6;
 
 // Function for printing ASCII byte-swapped strings, skipping white
@@ -378,6 +378,7 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
     if (disk->id && thre->id){
       char *type;
       int failednow,failedever;
+      char attributename[64];
 
       failednow =disk->current <= thre->threshold;
       failedever=disk->worst   <= thre->threshold;
@@ -408,11 +409,12 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
 	status="    -";
       
       // Print name of attribute
-      ataPrintSmartAttribName(disk->id);
-      
+      ataPrintSmartAttribName(attributename,disk->id);
+      pout("%-28s",attributename);
+
       // printing line for each valid attribute
       type=disk->status.flag.prefailure?"Pre-fail":"Old_age";
-      pout(" 0x%04x   %.3i   %.3i   %.3i    %-9s%-12s", 
+      pout("0x%04x   %.3i   %.3i   %.3i    %-9s%-12s", 
 	     disk->status.all, disk->current, disk->worst,
 	     thre->threshold, type, status);
       
@@ -695,113 +697,6 @@ void ataPseudoCheckSmart ( struct ata_smart_values data,
 	 "SMART overall-health self-assessment test result: PASSED");
 }
 
-void ataPrintSmartAttribName ( unsigned char id ){
-  char *name;
-  switch (id){
-    
-  case 1:
-    name="Raw_Read_Error_Rate";
-    break;
-  case 2:
-    name="Throughput_Performance";
-    break;
-  case 3:
-    name="Spin_Up_Time";
-    break;
-  case 4:
-    name="Start_Stop_Count";
-    break;
-  case 5:
-    name="Reallocated_Sector_Ct";
-    break;
-  case 6:
-    name="Read_Channel_Margin";
-    break;
-  case 7:
-    name="Seek_Error_Rate";
-    break;
-  case 8:
-    name="Seek_Time_Performance";
-    break;
-  case 9:
-    name="Power_On_Hours";
-    break;
-  case 10:
-    name="Spin_Retry_Count";
-    break;
-  case 11:
-    name="Calibration_Retry_Count";
-    break;
-  case 12:
-    name="Power_Cycle_Count";
-    break;
-  case 13:
-    name="Read_Soft_Error_Rate";
-    break;
-  case 191:
-    name="G-Sense_Error_Rate";
-    break;
-  case 192:
-    name="Power-Off_Retract_Count";
-    break;
-  case 193:
-    name="Load_Cycle_Count";
-    break;
-  case 194:
-    name="Temperature_Centigrade";
-    break;
-  case 195:
-    name="Hardware_ECC_Recovered";
-    break;
-  case 196:
-    name="Reallocated_Event_Count";
-    break;
-  case 197:
-    name="Current_Pending_Sector";
-    break;
-  case 198:
-    name="Offline_Uncorrectable";
-    break;
-  case 199:
-    name="UDMA_CRC_Error_Count";
-    break;
-  case 220:
-    name="Disk_Shift";
-    break;
-  case 221:
-    name="G-Sense_Error_Rate";
-    break;
-  case 222:
-    name="Loaded_Hours";
-    break;
-  case 223:
-    name="Load_Retry_Count";
-    break;
-  case 224:
-    name="Load_Friction";
-    break;
-  case 225:
-    name="Load_Cycle_Count";
-    break;
-  case 226:
-    name="Load-in_Time";
-    break;
-  case 227:
-    name="Torq-amp_Count";
-    break;
-  case 228:
-    name="Power-off_Retract_Count";
-    break;
-  default:
-    name="Unknown_Attribute";
-    break;
-  }
-  pout("%3d %-23s",id,name);
-}	
-
-/****
- Called by smartctl to access ataprint  
-**/
 
 
 // Initialize to zero just in case some SMART routines don't work
diff --git a/sm5/ataprint.cpp b/sm5/ataprint.cpp
index 7e4c749e8e78df679ec316407cf02ac1bc2b2003..972a27c6c1d6f53330eb9b60d1fdafeef3ff19d6 100644
--- a/sm5/ataprint.cpp
+++ b/sm5/ataprint.cpp
@@ -28,7 +28,7 @@
 #include "smartctl.h"
 #include "extern.h"
 
-const char *CVSid4="$Id: ataprint.cpp,v 1.32 2002/10/24 08:46:03 ballen4705 Exp $"
+const char *CVSid4="$Id: ataprint.cpp,v 1.33 2002/10/24 09:54:02 ballen4705 Exp $"
 CVSID2 CVSID3 CVSID6;
 
 // Function for printing ASCII byte-swapped strings, skipping white
@@ -378,6 +378,7 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
     if (disk->id && thre->id){
       char *type;
       int failednow,failedever;
+      char attributename[64];
 
       failednow =disk->current <= thre->threshold;
       failedever=disk->worst   <= thre->threshold;
@@ -408,11 +409,12 @@ void PrintSmartAttribWithThres (struct ata_smart_values data,
 	status="    -";
       
       // Print name of attribute
-      ataPrintSmartAttribName(disk->id);
-      
+      ataPrintSmartAttribName(attributename,disk->id);
+      pout("%-28s",attributename);
+
       // printing line for each valid attribute
       type=disk->status.flag.prefailure?"Pre-fail":"Old_age";
-      pout(" 0x%04x   %.3i   %.3i   %.3i    %-9s%-12s", 
+      pout("0x%04x   %.3i   %.3i   %.3i    %-9s%-12s", 
 	     disk->status.all, disk->current, disk->worst,
 	     thre->threshold, type, status);
       
@@ -695,113 +697,6 @@ void ataPseudoCheckSmart ( struct ata_smart_values data,
 	 "SMART overall-health self-assessment test result: PASSED");
 }
 
-void ataPrintSmartAttribName ( unsigned char id ){
-  char *name;
-  switch (id){
-    
-  case 1:
-    name="Raw_Read_Error_Rate";
-    break;
-  case 2:
-    name="Throughput_Performance";
-    break;
-  case 3:
-    name="Spin_Up_Time";
-    break;
-  case 4:
-    name="Start_Stop_Count";
-    break;
-  case 5:
-    name="Reallocated_Sector_Ct";
-    break;
-  case 6:
-    name="Read_Channel_Margin";
-    break;
-  case 7:
-    name="Seek_Error_Rate";
-    break;
-  case 8:
-    name="Seek_Time_Performance";
-    break;
-  case 9:
-    name="Power_On_Hours";
-    break;
-  case 10:
-    name="Spin_Retry_Count";
-    break;
-  case 11:
-    name="Calibration_Retry_Count";
-    break;
-  case 12:
-    name="Power_Cycle_Count";
-    break;
-  case 13:
-    name="Read_Soft_Error_Rate";
-    break;
-  case 191:
-    name="G-Sense_Error_Rate";
-    break;
-  case 192:
-    name="Power-Off_Retract_Count";
-    break;
-  case 193:
-    name="Load_Cycle_Count";
-    break;
-  case 194:
-    name="Temperature_Centigrade";
-    break;
-  case 195:
-    name="Hardware_ECC_Recovered";
-    break;
-  case 196:
-    name="Reallocated_Event_Count";
-    break;
-  case 197:
-    name="Current_Pending_Sector";
-    break;
-  case 198:
-    name="Offline_Uncorrectable";
-    break;
-  case 199:
-    name="UDMA_CRC_Error_Count";
-    break;
-  case 220:
-    name="Disk_Shift";
-    break;
-  case 221:
-    name="G-Sense_Error_Rate";
-    break;
-  case 222:
-    name="Loaded_Hours";
-    break;
-  case 223:
-    name="Load_Retry_Count";
-    break;
-  case 224:
-    name="Load_Friction";
-    break;
-  case 225:
-    name="Load_Cycle_Count";
-    break;
-  case 226:
-    name="Load-in_Time";
-    break;
-  case 227:
-    name="Torq-amp_Count";
-    break;
-  case 228:
-    name="Power-off_Retract_Count";
-    break;
-  default:
-    name="Unknown_Attribute";
-    break;
-  }
-  pout("%3d %-23s",id,name);
-}	
-
-/****
- Called by smartctl to access ataprint  
-**/
 
 
 // Initialize to zero just in case some SMART routines don't work
diff --git a/sm5/ataprint.h b/sm5/ataprint.h
index 8906bd05283a1d39efadefde258d974fd356dd56..c581129080d99e3b700f6ddb45c429f4f71e5d61 100644
--- a/sm5/ataprint.h
+++ b/sm5/ataprint.h
@@ -26,7 +26,7 @@
 #define _SMART_PRINT_H_
 
 #ifndef CVSID2
-#define CVSID2 "$Id: ataprint.h,v 1.11 2002/10/23 12:24:24 ballen4705 Exp $\n"
+#define CVSID2 "$Id: ataprint.h,v 1.12 2002/10/24 09:54:02 ballen4705 Exp $\n"
 #endif
 
 #include <stdio.h>
@@ -55,10 +55,6 @@ int ataPrintSmartSelfTestlog(struct ata_smart_selftestlog data, int allentries);
 void ataPseudoCheckSmart (struct ata_smart_values , 
                           struct ata_smart_thresholds );
 
-/* Prints Attribute Name for standard SMART attributes */
-/* prints 20 character string */
-void ataPrintSmartAttribName (unsigned char id);
-
 int ataPrintMain ( int fd );
 
 #endif
diff --git a/sm5/smartctl.8 b/sm5/smartctl.8
index a51d8c047b7a49225db743fab221862fc0d38587..02a3ffb9c1401cd8ee3ff87b87589de7d1d73264 100644
--- a/sm5/smartctl.8
+++ b/sm5/smartctl.8
@@ -1,6 +1,6 @@
 \# Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 \#
-\# $Id: smartctl.8,v 1.19 2002/10/24 08:50:35 ballen4705 Exp $
+\# $Id: smartctl.8,v 1.20 2002/10/24 09:54:02 ballen4705 Exp $
 \# 
 \# 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
@@ -15,7 +15,7 @@
 \# at the Concurrent Systems Laboratory (now part of the Storage Systems
 \# Research Center), Jack Baskin School of Engineering, University of
 \# California, Santa Cruz. http://ssrc.soe.ucsc.edu/
-.TH SMARTCTL 8  "$Date: 2002/10/24 08:50:35 $" "smartmontools-5.0"
+.TH SMARTCTL 8  "$Date: 2002/10/24 09:54:02 $" "smartmontools-5.0"
 .SH NAME
 smartctl \- S.M.A.R.T. control and monitor utility 
 .SH SYNOPSIS
@@ -269,11 +269,13 @@ found they will appear in the S.M.A.R.T. error log, visible with the '\-l' optio
 .B S 
 Selftest: Runs S.M.A.R.T. Short Self Test (usually under ten minutes).
 This command can be given during normal system operation.  This is a
-test in a different category than the immediate or automatic offline tests.
-The 'Self' tests check the electrical and mechanical performance as well
-as the read performance of the disk.  Their results are reported in
-the Self Test Error Log, readable with the '\-L' option.  Note that
-the progress of the test can be monitored by watching this log during the test.
+test in a different category than the immediate or automatic offline
+tests.  The 'Self' tests check the electrical and mechanical
+performance as well as the read performance of the disk.  Their
+results are reported in the Self Test Error Log, readable with
+the '\-L' option.  Note that on some disks the progress of the test can be
+monitored by watching this log during the test; with other disks use
+the '\-g option to monitor progress.
 .TP
 .B s
 Selftest: Runs the S.M.A.R.T. Short Self Test just described, in Captive Mode.
@@ -318,8 +320,7 @@ init files.  You can issue this command on a running system.
 .fi
 Begin an extended self-test of drive /dev/hdc.  You can issue this
 command on a running system.  The results can be seen in the self-test
-log visible with the '\-L' option while the test is running and after
-it has completed.
+log visible with the '\-L' option after it has completed.
 .PP
 .nf
 .B smartctl -eO /dev/hda
@@ -329,12 +330,28 @@ drive /dev/hda.  You can issue this command on a running system.  The
 results uare only used to update the S.M.A.R.T. attributes, visible
 with the '\-v' option.  If any device errors occur, they are logged
 the S.M.A.R.T. error log., which can be seen with the '\-l' option.
- .PP
+.PP
 .nf
 .B smartctl -vm /dev/hda
 .fi
-shows the vendor attributes, when the disk stores its power-on time
+Shows the vendor attributes, when the disk stores its power-on time
 internally in minutes rather than hours.
+.PP
+.nf
+.B smartctl -qcL /dev/hda
+.fi
+Produces output only if the device returns failing S.M.A.R.T. status,
+or if some of the logged self-tests ended with errors.
+.PP
+.nf
+.B smartctl -Qa /dev/hda
+.fi
+Examine all S.M.A.R.T. data for device /dev/hda, but produce no
+printed output.  You must use the exit status (the
+.B $?
+shell variable) to learn if any attributes are out of bound, if the
+S.M.A.R.T. status is failing, if there are errors recorded in the
+self-test log, or if there are errors recorded in the disk error log.
 
 .PP
 .SH RETURN VALUES
@@ -441,4 +458,4 @@ Please let us know if there is an on\-line source for this document.
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartctl.8,v 1.19 2002/10/24 08:50:35 ballen4705 Exp $
+$Id: smartctl.8,v 1.20 2002/10/24 09:54:02 ballen4705 Exp $
diff --git a/sm5/smartd.c b/sm5/smartd.c
index 4ef4577c1e549e8206ecdea411e415bdfe596cc3..675f7a74146b04d406f3c358451a007b54893aed 100644
--- a/sm5/smartd.c
+++ b/sm5/smartd.c
@@ -34,9 +34,10 @@
 #include "atacmds.h"
 #include "scsicmds.h"
 #include "smartd.h"
+#include "ataprint.h"
 
 extern const char *CVSid1, *CVSid2;
-const char *CVSid3="$Id: smartd.c,v 1.16 2002/10/24 07:50:45 ballen4705 Exp $" 
+const char *CVSid3="$Id: smartd.c,v 1.17 2002/10/24 09:54:02 ballen4705 Exp $" 
 CVSID1 CVSID4 CVSID7;
 
 int daemon_init(void){
@@ -211,10 +212,13 @@ void ataCompareSmartValues (atadevices_t *device, struct ata_smart_values new ){
 	// if it's a valid attribute, compare values
 	newval=new.vendor_attributes[i].current;
 	oldval=device->smartval.vendor_attributes[i].current;
-	if (oldval!=newval)
+	if (oldval!=newval){
 	  // values have changed; print them
-	  printout(LOG_INFO, "Device: %s, S.M.A.R.T. Attribute: %i Changed from %i to %i\n",
-		   device->devicename,idnew,oldval,newval);
+	  char attributename[64];
+	  ataPrintSmartAttribName(attributename,idnew);
+	  printout(LOG_INFO, "Device: %s, S.M.A.R.T. Attribute: %s Changed from %i to %i\n",
+		   device->devicename,attributename,oldval,newval);
+	}
       }
     }
 }
@@ -224,6 +228,7 @@ int ataCheckDevice( atadevices_t *drive){
   struct ata_smart_values tempsmartval;
   struct ata_smart_thresholds tempsmartthres;
   int failed;
+  char attributename[64];
 
   // Coming into this function, *drive contains the last values measured,
   // and we read the NEW values into tempsmartval
@@ -235,11 +240,15 @@ int ataCheckDevice( atadevices_t *drive){
     printout(LOG_INFO, "%s:Failed to read smart thresholds\n",drive->devicename);
   
   // See if any vendor attributes are below minimum, and print them out
-  if ((failed=ataCheckSmart(tempsmartval,tempsmartthres,1)))
-    printout(LOG_CRIT,"Device: %s, Failed attribute: %i\n",drive->devicename,failed);
-  
-  // WHEN IT WORKS, we should here add a call to ataSmartStatus2()
+  if ((failed=ataCheckSmart(tempsmartval,tempsmartthres,1))){
+    ataPrintSmartAttribName(attributename,failed);
+    printout(LOG_CRIT,"Device: %s, Failed attribute: %s\n",drive->devicename,attributename);
+  }
 
+  // WHEN IT WORKS, we should here add a call to ataSmartStatus2()
+  // either in addition to or instead of the ataCheckSmart command
+  // above. This is the "right" long-term solution.
+  
   // see if any values have changed.  Second argument is new values
   ataCompareSmartValues (drive , tempsmartval);
   
diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp
index 2b23965f1c1fac7fd040d91e08f9165c34bc47cc..513cb7dacd41740bc8b4c3adca5d21c45c5d2a8c 100644
--- a/sm5/smartd.cpp
+++ b/sm5/smartd.cpp
@@ -34,9 +34,10 @@
 #include "atacmds.h"
 #include "scsicmds.h"
 #include "smartd.h"
+#include "ataprint.h"
 
 extern const char *CVSid1, *CVSid2;
-const char *CVSid3="$Id: smartd.cpp,v 1.16 2002/10/24 07:50:45 ballen4705 Exp $" 
+const char *CVSid3="$Id: smartd.cpp,v 1.17 2002/10/24 09:54:02 ballen4705 Exp $" 
 CVSID1 CVSID4 CVSID7;
 
 int daemon_init(void){
@@ -211,10 +212,13 @@ void ataCompareSmartValues (atadevices_t *device, struct ata_smart_values new ){
 	// if it's a valid attribute, compare values
 	newval=new.vendor_attributes[i].current;
 	oldval=device->smartval.vendor_attributes[i].current;
-	if (oldval!=newval)
+	if (oldval!=newval){
 	  // values have changed; print them
-	  printout(LOG_INFO, "Device: %s, S.M.A.R.T. Attribute: %i Changed from %i to %i\n",
-		   device->devicename,idnew,oldval,newval);
+	  char attributename[64];
+	  ataPrintSmartAttribName(attributename,idnew);
+	  printout(LOG_INFO, "Device: %s, S.M.A.R.T. Attribute: %s Changed from %i to %i\n",
+		   device->devicename,attributename,oldval,newval);
+	}
       }
     }
 }
@@ -224,6 +228,7 @@ int ataCheckDevice( atadevices_t *drive){
   struct ata_smart_values tempsmartval;
   struct ata_smart_thresholds tempsmartthres;
   int failed;
+  char attributename[64];
 
   // Coming into this function, *drive contains the last values measured,
   // and we read the NEW values into tempsmartval
@@ -235,11 +240,15 @@ int ataCheckDevice( atadevices_t *drive){
     printout(LOG_INFO, "%s:Failed to read smart thresholds\n",drive->devicename);
   
   // See if any vendor attributes are below minimum, and print them out
-  if ((failed=ataCheckSmart(tempsmartval,tempsmartthres,1)))
-    printout(LOG_CRIT,"Device: %s, Failed attribute: %i\n",drive->devicename,failed);
-  
-  // WHEN IT WORKS, we should here add a call to ataSmartStatus2()
+  if ((failed=ataCheckSmart(tempsmartval,tempsmartthres,1))){
+    ataPrintSmartAttribName(attributename,failed);
+    printout(LOG_CRIT,"Device: %s, Failed attribute: %s\n",drive->devicename,attributename);
+  }
 
+  // WHEN IT WORKS, we should here add a call to ataSmartStatus2()
+  // either in addition to or instead of the ataCheckSmart command
+  // above. This is the "right" long-term solution.
+  
   // see if any values have changed.  Second argument is new values
   ataCompareSmartValues (drive , tempsmartval);