From 6f61a056a0423f2c0ea6185200a711092780686e Mon Sep 17 00:00:00 2001
From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137>
Date: Thu, 7 Nov 2002 19:07:20 +0000
Subject: [PATCH] inserted ANSI prototype; trivial cleanups

git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@223 4ea69e1a-61f1-4043-bf83-b5c94c648137
---
 sm5/CHANGELOG    | 7 ++++++-
 sm5/Makefile     | 4 +---
 sm5/VERSION      | 2 +-
 sm5/atacmds.c    | 6 ++++--
 sm5/atacmds.cpp  | 6 ++++--
 sm5/ataprint.c   | 9 ++-------
 sm5/ataprint.cpp | 9 ++-------
 sm5/smartctl.c   | 5 ++---
 sm5/smartctl.cpp | 5 ++---
 sm5/smartctl.h   | 4 ++--
 10 files changed, 26 insertions(+), 31 deletions(-)

diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG
index d3ad4541c..aa21a4120 100644
--- a/sm5/CHANGELOG
+++ b/sm5/CHANGELOG
@@ -1,6 +1,6 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.38 2002/11/07 11:28:17 ballen4705 Exp $
+$Id: CHANGELOG,v 1.39 2002/11/07 19:07:20 ballen4705 Exp $
 
 Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
@@ -25,6 +25,11 @@ NOTES FOR FUTURE RELEASES: see TODO file.
 
 CURRENT RELEASE (see VERSION file in this directory):
 
+  smartctl: Missing ANSI prototype in failuretest(); fixed.
+
+  smartctl: Checksum warnings now printed on stdout, or are silent,
+  depending upon -q and -Q settings.
+
 smartmontools-5.0.31
 
   Changed Makefile so that the -V option does not reflect file state
diff --git a/sm5/Makefile b/sm5/Makefile
index 3b2cf3b94..ce8502336 100644
--- a/sm5/Makefile
+++ b/sm5/Makefile
@@ -2,7 +2,7 @@
 #
 # Home page: http://smartmontools.sourceforge.net
 #
-# $Id: Makefile,v 1.34 2002/11/07 11:28:17 ballen4705 Exp $
+# $Id: Makefile,v 1.35 2002/11/07 19:07:20 ballen4705 Exp $
 #
 # Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 # 
@@ -133,6 +133,4 @@ release:
 	mv /usr/src/redhat/RPMS/i386/$(pkgname)*.rpm .
 	mv /usr/src/redhat/SRPMS/$(pkgname)*rpm .
 	rm -f /usr/src/redhat/SOURCES/$(pkgname).tar.gz
-	. cvs-script && cvs commit -m "release $(counter)"
-	. cvs-script && cvs tag -d "RELEASE_5_0_$(counter)" && cvs tag "RELEASE_5_0_$(counter)"
 	echo `hostname` | grep -q ballen && echo $(newcounter) > VERSION && chown ballen.ballen *
diff --git a/sm5/VERSION b/sm5/VERSION
index e85087aff..f5c89552b 100644
--- a/sm5/VERSION
+++ b/sm5/VERSION
@@ -1 +1 @@
-31
+32
diff --git a/sm5/atacmds.c b/sm5/atacmds.c
index 35cfbf364..dba8516f5 100644
--- a/sm5/atacmds.c
+++ b/sm5/atacmds.c
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include "atacmds.h"
 
-const char *CVSid1="$Id: atacmds.c,v 1.37 2002/11/07 11:00:55 ballen4705 Exp $" CVSID1;
+const char *CVSid1="$Id: atacmds.c,v 1.38 2002/11/07 19:07:20 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
@@ -588,7 +588,9 @@ int TestTime(struct ata_smart_values *data,int testtype){
   }
 }
 
-
+// This function tells you both about the ATA error log and the
+// self-test error log capability.  The bit is poorly documented in
+// the ATA/ATAPI standard.
 int isSmartErrorLogCapable ( struct ata_smart_values *data){
    return data->errorlog_capability & 0x01;
 }
diff --git a/sm5/atacmds.cpp b/sm5/atacmds.cpp
index 00c08b0c8..61c7340f9 100644
--- a/sm5/atacmds.cpp
+++ b/sm5/atacmds.cpp
@@ -29,7 +29,7 @@
 #include <stdlib.h>
 #include "atacmds.h"
 
-const char *CVSid1="$Id: atacmds.cpp,v 1.37 2002/11/07 11:00:55 ballen4705 Exp $" CVSID1;
+const char *CVSid1="$Id: atacmds.cpp,v 1.38 2002/11/07 19:07:20 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
@@ -588,7 +588,9 @@ int TestTime(struct ata_smart_values *data,int testtype){
   }
 }
 
-
+// This function tells you both about the ATA error log and the
+// self-test error log capability.  The bit is poorly documented in
+// the ATA/ATAPI standard.
 int isSmartErrorLogCapable ( struct ata_smart_values *data){
    return data->errorlog_capability & 0x01;
 }
diff --git a/sm5/ataprint.c b/sm5/ataprint.c
index b995b470d..7ff6c631b 100644
--- a/sm5/ataprint.c
+++ b/sm5/ataprint.c
@@ -30,7 +30,7 @@
 #include "smartctl.h"
 #include "extern.h"
 
-const char *CVSid2="$Id: ataprint.c,v 1.42 2002/11/07 11:00:55 ballen4705 Exp $"
+const char *CVSid2="$Id: ataprint.c,v 1.43 2002/11/07 19:07:20 ballen4705 Exp $"
 CVSID1 CVSID2 CVSID3 CVSID6;
 
 // for passing global control variables
@@ -703,7 +703,7 @@ void ataPseudoCheckSmart ( struct ata_smart_values *data,
 
 // Compares failure type to policy in effect, and either exits or
 // simply returns to the calling routine.
-void failuretest(type, returnvalue){
+void failuretest(int type, int returnvalue){
 
   // If this is an error in an "optional" SMART command
   if (type==OPTIONAL_CMD){
@@ -732,12 +732,8 @@ void failuretest(type, returnvalue){
 // abort on invalid checksums.
 void checksumwarning(const char *string){
   pout("Warning! %s error: invalid SMART checksum.\n",string);
-  fprintf(stderr,"Warning! %s error: invalid SMART checksum.\n",string);
-  syslog(LOG_INFO,"Warning! %s error: invalid SMART checksum.\n",string);
-
   if (con->checksumfail)
     exit(FAILSMART);
-
   return;
 }
 
@@ -950,7 +946,6 @@ int ataPrintMain (int fd){
     if (ataReadErrorLog(fd, &smarterror)){
       pout("Smartctl: SMART Errorlog Read Failed\n");
       failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
-
     }
     else {
       // quiet mode is turned on inside ataPrintSmartErrorLog()
diff --git a/sm5/ataprint.cpp b/sm5/ataprint.cpp
index 6f3fc601d..a83265312 100644
--- a/sm5/ataprint.cpp
+++ b/sm5/ataprint.cpp
@@ -30,7 +30,7 @@
 #include "smartctl.h"
 #include "extern.h"
 
-const char *CVSid2="$Id: ataprint.cpp,v 1.42 2002/11/07 11:00:55 ballen4705 Exp $"
+const char *CVSid2="$Id: ataprint.cpp,v 1.43 2002/11/07 19:07:20 ballen4705 Exp $"
 CVSID1 CVSID2 CVSID3 CVSID6;
 
 // for passing global control variables
@@ -703,7 +703,7 @@ void ataPseudoCheckSmart ( struct ata_smart_values *data,
 
 // Compares failure type to policy in effect, and either exits or
 // simply returns to the calling routine.
-void failuretest(type, returnvalue){
+void failuretest(int type, int returnvalue){
 
   // If this is an error in an "optional" SMART command
   if (type==OPTIONAL_CMD){
@@ -732,12 +732,8 @@ void failuretest(type, returnvalue){
 // abort on invalid checksums.
 void checksumwarning(const char *string){
   pout("Warning! %s error: invalid SMART checksum.\n",string);
-  fprintf(stderr,"Warning! %s error: invalid SMART checksum.\n",string);
-  syslog(LOG_INFO,"Warning! %s error: invalid SMART checksum.\n",string);
-
   if (con->checksumfail)
     exit(FAILSMART);
-
   return;
 }
 
@@ -950,7 +946,6 @@ int ataPrintMain (int fd){
     if (ataReadErrorLog(fd, &smarterror)){
       pout("Smartctl: SMART Errorlog Read Failed\n");
       failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
-
     }
     else {
       // quiet mode is turned on inside ataPrintSmartErrorLog()
diff --git a/sm5/smartctl.c b/sm5/smartctl.c
index e7cc4b943..0a21f1f92 100644
--- a/sm5/smartctl.c
+++ b/sm5/smartctl.c
@@ -39,7 +39,7 @@
 #include "extern.h"
 
 extern const char *CVSid1, *CVSid2, *CVSid3, *CVSid4; 
-const char* CVSid5="$Id: smartctl.c,v 1.26 2002/11/07 11:00:56 ballen4705 Exp $"
+const char* CVSid5="$Id: smartctl.c,v 1.27 2002/11/07 19:07:20 ballen4705 Exp $"
 CVSID1 CVSID2 CVSID3 CVSID4 CVSID5 CVSID6;
 
 // This is a block containing all the "control variables".  We declare
@@ -325,8 +325,7 @@ int main (int argc, char **argv){
   }
   
   // open device - read-only mode is enough to issue needed commands
-  fd = open(device=argv[2], O_RDONLY);
-  
+  fd = open(device=argv[2], O_RDONLY);  
   if (fd<0) {
     perror("Smartctl device open failed");
     return FAILDEV;
diff --git a/sm5/smartctl.cpp b/sm5/smartctl.cpp
index b299655a8..64e4948a8 100644
--- a/sm5/smartctl.cpp
+++ b/sm5/smartctl.cpp
@@ -39,7 +39,7 @@
 #include "extern.h"
 
 extern const char *CVSid1, *CVSid2, *CVSid3, *CVSid4; 
-const char* CVSid5="$Id: smartctl.cpp,v 1.26 2002/11/07 11:00:56 ballen4705 Exp $"
+const char* CVSid5="$Id: smartctl.cpp,v 1.27 2002/11/07 19:07:20 ballen4705 Exp $"
 CVSID1 CVSID2 CVSID3 CVSID4 CVSID5 CVSID6;
 
 // This is a block containing all the "control variables".  We declare
@@ -325,8 +325,7 @@ int main (int argc, char **argv){
   }
   
   // open device - read-only mode is enough to issue needed commands
-  fd = open(device=argv[2], O_RDONLY);
-  
+  fd = open(device=argv[2], O_RDONLY);  
   if (fd<0) {
     perror("Smartctl device open failed");
     return FAILDEV;
diff --git a/sm5/smartctl.h b/sm5/smartctl.h
index 3b18efef9..5a59a2ef7 100644
--- a/sm5/smartctl.h
+++ b/sm5/smartctl.h
@@ -26,7 +26,7 @@
 #define __SMARTCTL_H_
 
 #ifndef CVSID6
-#define CVSID6 "$Id: smartctl.h,v 1.12 2002/11/07 11:00:56 ballen4705 Exp $\n"
+#define CVSID6 "$Id: smartctl.h,v 1.13 2002/11/07 19:07:20 ballen4705 Exp $\n"
 #endif
 
 /* Defines for command line options */ 
@@ -55,7 +55,7 @@
 #define VERYQUIETMODE           'Q'
 #define NOTATADEVICE            'N'
 #define NOTSCSIDEVICE           'n'
-#define EXITCHECKSUMERROR        'W'
+#define EXITCHECKSUMERROR       'W'
 #define ULTRACONSERVATIVE       'U'
 #define PERMISSIVE              'P'
 
-- 
GitLab