From 33e75ca707c02bcaa6be7b1781f5fd505da61857 Mon Sep 17 00:00:00 2001 From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Fri, 11 Oct 2002 03:46:17 +0000 Subject: [PATCH] Fixed problem with static initializer in opts[] git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@22 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/smartctl.8 | 8 ++++---- sm5/smartctl.c | 34 ++++++++++++++++------------------ sm5/smartctl.cpp | 34 ++++++++++++++++------------------ sm5/smartd.8 | 42 +++++++++++++++++++++++++++++++----------- sm5/smartd.c | 13 +++++++------ sm5/smartd.cpp | 13 +++++++------ 6 files changed, 81 insertions(+), 63 deletions(-) diff --git a/sm5/smartctl.8 b/sm5/smartctl.8 index c75272f99..6df5f226a 100644 --- a/sm5/smartctl.8 +++ b/sm5/smartctl.8 @@ -1,6 +1,6 @@ \# Copyright (C) 2002 Bruce Allen <ballen@uwm.edu> \# -\# $Id: smartctl.8,v 1.4 2002/10/10 13:21:15 ballen4705 Exp $ +\# $Id: smartctl.8,v 1.5 2002/10/11 03:46:17 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 @@ -10,7 +10,7 @@ \# You should have received a copy of the GNU General Public License (for \# example COPYING); if not, write to the Free Software Foundation, Inc., 675 \# Mass Ave, Cambridge, MA 02139, USA. -.TH SMARTCTL 8 "$Date: 2002/10/10 13:21:15 $" "smartmontools-5.0" +.TH SMARTCTL 8 "$Date: 2002/10/11 03:46:17 $" "smartmontools-5.0" .SH NAME smartctl \- S.M.A.R.T. control utility .SH SYNOPSIS @@ -57,7 +57,7 @@ p. .B Read-only options: .TP p -Print: Prints Copyright and License information. +Print: Prints version, copyright and license information. .TP i Information: Check if the device supports S.M.A.R.T. Prints the @@ -296,4 +296,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.4 2002/10/10 13:21:15 ballen4705 Exp $ +$Id: smartctl.8,v 1.5 2002/10/11 03:46:17 ballen4705 Exp $ diff --git a/sm5/smartctl.c b/sm5/smartctl.c index c281cc49b..d1d3f60a9 100644 --- a/sm5/smartctl.c +++ b/sm5/smartctl.c @@ -1,4 +1,4 @@ -// $Id: smartctl.c,v 1.3 2002/10/11 00:38:22 ballen4705 Exp $ +// $Id: smartctl.c,v 1.4 2002/10/11 03:46:17 ballen4705 Exp $ /* * smartctl.c * @@ -113,25 +113,23 @@ void Usage ( void){ } +const char opts[] = { + DRIVEINFO, CHECKSMART, SMARTVERBOSEALL, SMARTVENDORATTRIB, + GENERALSMARTVALUES, SMARTERRORLOG, SMARTSELFTESTLOG, SMARTDISABLE, + SMARTENABLE, SMARTAUTOOFFLINEENABLE, SMARTAUTOOFFLINEDISABLE, + SMARTEXEOFFIMMEDIATE, SMARTSHORTSELFTEST, SMARTEXTENDSELFTEST, + SMARTSHORTCAPSELFTEST, SMARTEXTENDCAPSELFTEST, SMARTSELFTESTABORT, + SMARTAUTOSAVEENABLE,SMARTAUTOSAVEDISABLE,PRINTCOPYLEFT,'\0' +}; -/* void ParseOpts ( chars *opts) - Takes command options and sets features to be run */ - +/* Takes command options and sets features to be run */ void ParseOpts (int argc, char** argv){ - int optchar; - extern char *optarg; - extern int optopt, optind; - const char opts[] = { - DRIVEINFO, CHECKSMART, SMARTVERBOSEALL, SMARTVENDORATTRIB, - GENERALSMARTVALUES, SMARTERRORLOG, SMARTSELFTESTLOG, SMARTDISABLE, - SMARTENABLE, SMARTAUTOOFFLINEENABLE, SMARTAUTOOFFLINEDISABLE, - SMARTEXEOFFIMMEDIATE, SMARTSHORTSELFTEST, SMARTEXTENDSELFTEST, - SMARTSHORTCAPSELFTEST, SMARTEXTENDCAPSELFTEST, SMARTSELFTESTABORT, - SMARTAUTOSAVEENABLE,SMARTAUTOSAVEDISABLE,PRINTCOPYLEFT,'\0' - }; - + int optchar; + extern char *optarg; + extern int optopt, optind, opterr; - while(EOF != (optchar = getopt(argc, argv, opts))) { + opterr=1; + while (-1 != (optchar = getopt(argc, argv, opts))) { switch (optchar){ case PRINTCOPYLEFT : printcopyleft=TRUE; @@ -231,7 +229,7 @@ int main (int argc, char **argv){ printf("is free software, and you are welcome to redistribute it\n"); printf("under the terms of the GNU General Public License Version 2.\n"); printf("See http://www.gnu.org for further details.\n\n"); - printf("CVS version ID %s\n","$Id: smartctl.c,v 1.3 2002/10/11 00:38:22 ballen4705 Exp $"); + printf("CVS version ID %s\n","$Id: smartctl.c,v 1.4 2002/10/11 03:46:17 ballen4705 Exp $"); exit(0); } diff --git a/sm5/smartctl.cpp b/sm5/smartctl.cpp index 1a3a4df7e..fc9334c47 100644 --- a/sm5/smartctl.cpp +++ b/sm5/smartctl.cpp @@ -1,4 +1,4 @@ -// $Id: smartctl.cpp,v 1.3 2002/10/11 00:38:22 ballen4705 Exp $ +// $Id: smartctl.cpp,v 1.4 2002/10/11 03:46:17 ballen4705 Exp $ /* * smartctl.c * @@ -113,25 +113,23 @@ void Usage ( void){ } +const char opts[] = { + DRIVEINFO, CHECKSMART, SMARTVERBOSEALL, SMARTVENDORATTRIB, + GENERALSMARTVALUES, SMARTERRORLOG, SMARTSELFTESTLOG, SMARTDISABLE, + SMARTENABLE, SMARTAUTOOFFLINEENABLE, SMARTAUTOOFFLINEDISABLE, + SMARTEXEOFFIMMEDIATE, SMARTSHORTSELFTEST, SMARTEXTENDSELFTEST, + SMARTSHORTCAPSELFTEST, SMARTEXTENDCAPSELFTEST, SMARTSELFTESTABORT, + SMARTAUTOSAVEENABLE,SMARTAUTOSAVEDISABLE,PRINTCOPYLEFT,'\0' +}; -/* void ParseOpts ( chars *opts) - Takes command options and sets features to be run */ - +/* Takes command options and sets features to be run */ void ParseOpts (int argc, char** argv){ - int optchar; - extern char *optarg; - extern int optopt, optind; - const char opts[] = { - DRIVEINFO, CHECKSMART, SMARTVERBOSEALL, SMARTVENDORATTRIB, - GENERALSMARTVALUES, SMARTERRORLOG, SMARTSELFTESTLOG, SMARTDISABLE, - SMARTENABLE, SMARTAUTOOFFLINEENABLE, SMARTAUTOOFFLINEDISABLE, - SMARTEXEOFFIMMEDIATE, SMARTSHORTSELFTEST, SMARTEXTENDSELFTEST, - SMARTSHORTCAPSELFTEST, SMARTEXTENDCAPSELFTEST, SMARTSELFTESTABORT, - SMARTAUTOSAVEENABLE,SMARTAUTOSAVEDISABLE,PRINTCOPYLEFT,'\0' - }; - + int optchar; + extern char *optarg; + extern int optopt, optind, opterr; - while(EOF != (optchar = getopt(argc, argv, opts))) { + opterr=1; + while (-1 != (optchar = getopt(argc, argv, opts))) { switch (optchar){ case PRINTCOPYLEFT : printcopyleft=TRUE; @@ -231,7 +229,7 @@ int main (int argc, char **argv){ printf("is free software, and you are welcome to redistribute it\n"); printf("under the terms of the GNU General Public License Version 2.\n"); printf("See http://www.gnu.org for further details.\n\n"); - printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.3 2002/10/11 00:38:22 ballen4705 Exp $"); + printf("CVS version ID %s\n","$Id: smartctl.cpp,v 1.4 2002/10/11 03:46:17 ballen4705 Exp $"); exit(0); } diff --git a/sm5/smartd.8 b/sm5/smartd.8 index 5a16877f8..d00d2883e 100644 --- a/sm5/smartd.8 +++ b/sm5/smartd.8 @@ -8,7 +8,7 @@ \# You should have received a copy of the GNU General Public License (for \# example COPYING); if not, write to the Free Software Foundation, Inc., 675 \# Mass Ave, Cambridge, MA 02139, USA. -.TH SMARTD 8 "$Date: 2002/10/10 13:21:17 $" "smartmontools-5.0" +.TH SMARTD 8 "$Date: 2002/10/11 03:46:17 $" "smartmontools-5.0" .SH NAME smartd \- S.M.A.R.T. Daemon .SH SYNOPSIS @@ -26,7 +26,7 @@ smartd is compatible with ATA/ATAPI-5 and earlier standards (see REFERENCES below) .B smartd -is daemon designed to notify users of S.M.A.R.T. errors and changes of +will notify users of S.M.A.R.T. errors and changes of S.M.A.R.T. attributes via the SYSLOG interface. These notifications and warnings normally appear in /var/log/messages. @@ -45,12 +45,18 @@ smartd daemon scans for all devices that support S.M.A.R.T., using "/dev/hd*" for IDE/ATA devices, and "/dev/sd*" for SCSI devices. It polls these devices every 30 minutes checking for S.M.A.R.T. errors. -.PP +[Note that on start-up, when +.B +smartd +scans for devices, a warning message may appear in +/var/log/messages, about missing block-major-xx devices. These +messages are harmless.] +.P .SH OPTIONS .TP p -Prints license and copyright information onto STDOUT and into the SYSLOG +Prints license, copyright, and version information onto STDOUT or into the SYSLOG log (normally /var/log/messages) and then exits. .TP X @@ -63,21 +69,35 @@ displays status information to STDOUT. .B smartd .fi -runs in forked (daemon) mode. This is the normal way to run +runs the daemon in forked mode. This is the normal way to run .B -smartd +smartd. .fi +.fi Note that smartmontools provides a start-up script in +.B /etc/rc.d/init.d/smartd +which is responsible for starting and stopping the daemon via the +normal init interface. +Using this script, you can start .B -/etc/rc.d/init.d/smartd -which is responsible for starting and stopping the daemon via the normal init interface. This can be enabled using the command: +smartd +by giving the command +.B '/etc/rc.d/init.d/smartd start' +and stop it by using +.B '/etc/rc.d/init.d/smartd stop'. + +If you want +.B +smartd +to start running whenever your machine is booted, this can be enabled by using the command: .nf -/sbin/chkconfig --add smartd +.B '/sbin/chkconfig --add smartd' .fi and disabled using the command: .nf -/sbin/chkconfig --del smartd +.B '/sbin/chkconfig --del smartd' + .PP .SH AUTHOR @@ -149,4 +169,4 @@ Please let us know if there is an on\-line source for this document. .SH CVS ID OF THIS PAGE: -$Id: smartd.8,v 1.4 2002/10/10 13:21:17 ballen4705 Exp $ +$Id: smartd.8,v 1.5 2002/10/11 03:46:17 ballen4705 Exp $ diff --git a/sm5/smartd.c b/sm5/smartd.c index af8ca74ff..3ee6a2f65 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -1,4 +1,4 @@ -// $Id: smartd.c,v 1.4 2002/10/11 00:38:22 ballen4705 Exp $ +// $Id: smartd.c,v 1.5 2002/10/11 03:46:17 ballen4705 Exp $ /* * smartd.c * @@ -264,8 +264,9 @@ char copyleftstring[]= "is free software, and you are welcome to redistribute it\n" "under the terms of the GNU General Public License Version 2.\n" "See http://www.gnu.org for further details.\n\n" -"CVS Version ID $Id: smartd.c,v 1.4 2002/10/11 00:38:22 ballen4705 Exp $\n"; +"CVS Version ID $Id: smartd.c,v 1.5 2002/10/11 03:46:17 ballen4705 Exp $\n"; +const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' }; /* Main Program */ int main (int argc, char **argv){ @@ -274,15 +275,15 @@ int main (int argc, char **argv){ scsidevices_t scsidevices[MAXSCSIDEVICES], *scsidevicesptr; int optchar; extern char *optarg; - extern int optopt, optind; - const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' }; - + extern int optopt, optind, opterr; + numatadevices=0; numscsidevices=0; scsidevicesptr = scsidevices; atadevicesptr = atadevices; + opterr=1; - while(EOF != (optchar = getopt(argc, argv, opts))){ + while (-1 != (optchar = getopt(argc, argv, opts))){ switch(optchar) { case PRINTCOPYLEFT: printcopyleft=TRUE; diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index f1255ac57..68ab0d50c 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -1,4 +1,4 @@ -// $Id: smartd.cpp,v 1.4 2002/10/11 00:38:22 ballen4705 Exp $ +// $Id: smartd.cpp,v 1.5 2002/10/11 03:46:17 ballen4705 Exp $ /* * smartd.c * @@ -264,8 +264,9 @@ char copyleftstring[]= "is free software, and you are welcome to redistribute it\n" "under the terms of the GNU General Public License Version 2.\n" "See http://www.gnu.org for further details.\n\n" -"CVS Version ID $Id: smartd.cpp,v 1.4 2002/10/11 00:38:22 ballen4705 Exp $\n"; +"CVS Version ID $Id: smartd.cpp,v 1.5 2002/10/11 03:46:17 ballen4705 Exp $\n"; +const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' }; /* Main Program */ int main (int argc, char **argv){ @@ -274,15 +275,15 @@ int main (int argc, char **argv){ scsidevices_t scsidevices[MAXSCSIDEVICES], *scsidevicesptr; int optchar; extern char *optarg; - extern int optopt, optind; - const char opts[] = { DEBUGMODE, EMAILNOTIFICATION, PRINTCOPYLEFT,'\0' }; - + extern int optopt, optind, opterr; + numatadevices=0; numscsidevices=0; scsidevicesptr = scsidevices; atadevicesptr = atadevices; + opterr=1; - while(EOF != (optchar = getopt(argc, argv, opts))){ + while (-1 != (optchar = getopt(argc, argv, opts))){ switch(optchar) { case PRINTCOPYLEFT: printcopyleft=TRUE; -- GitLab