From f318313b089de6230caabe8e96fbd108025f8298 Mon Sep 17 00:00:00 2001 From: pjwilliams <pjwilliams@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Sat, 4 Jan 2003 19:34:29 +0000 Subject: [PATCH] Added -D, --showdirectives option to smartd git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@420 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/CHANGELOG | 4 +++- sm5/README | 1 + sm5/smartd.8 | 9 ++++++--- sm5/smartd.c | 32 +++++++++++++++++++------------- sm5/smartd.cpp | 32 +++++++++++++++++++------------- 5 files changed, 48 insertions(+), 30 deletions(-) diff --git a/sm5/CHANGELOG b/sm5/CHANGELOG index a287c25b0..a04676d03 100644 --- a/sm5/CHANGELOG +++ b/sm5/CHANGELOG @@ -1,6 +1,6 @@ CHANGELOG for smartmontools -$Id: CHANGELOG,v 1.81 2003/01/04 10:28:35 ballen4705 Exp $ +$Id: CHANGELOG,v 1.82 2003/01/04 19:34:29 pjwilliams Exp $ Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> @@ -36,6 +36,8 @@ CURRENT RELEASE (see VERSION file in this directory): smartmontools-5.1.1 + [PW] Added -D, --showdirectives option to smartd + [DG] add '-l selftest' capability for SCSI devices (update smartctl.8) [BA] smartd,smartctl: added additional Attribute modification option diff --git a/sm5/README b/sm5/README index cf2ac1f5e..332229335 100644 --- a/sm5/README +++ b/sm5/README @@ -249,5 +249,6 @@ Changes to smartd options: -V --version, --copyright, --license -V --version, --copyright, --license -X --debug -d --debug -i N --interval=N + -D --showdirectives ---------------------------------------------------------------------------------------------------------- diff --git a/sm5/smartd.8 b/sm5/smartd.8 index 3f3ef64fd..9d6efc5a1 100644 --- a/sm5/smartd.8 +++ b/sm5/smartd.8 @@ -1,6 +1,6 @@ \# Copyright (C) 2002 Bruce Allen <smartmontools-support@lists.sourceforge.net> \# -\# $Id: smartd.8,v 1.49 2003/01/04 13:45:41 ballen4705 Exp $ +\# $Id: smartd.8,v 1.50 2003/01/04 19:31:38 pjwilliams 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 @@ -16,7 +16,7 @@ \# Research Center), Jack Baskin School of Engineering, University of \# California, Santa Cruz. http://ssrc.soe.ucsc.edu/ \# -.TH SMARTD 8 "$Date: 2003/01/04 13:45:41 $" "smartmontools-5.1" +.TH SMARTD 8 "$Date: 2003/01/04 19:31:38 $" "smartmontools-5.1" .SH NAME smartd \- S.M.A.R.T. Daemon .SH SYNOPSIS @@ -105,6 +105,9 @@ in "debug" mode. In this mode, it does not (2) and displays status information to STDOUT. It also prints more verbose information about what it is doing. .TP +.B \-D, \-\-showdirectives +Prints the configuration file Directives to STDOUT and exits. +.TP .B \-i N, \-\-interval=N Sets the interval between disk checks to .I N @@ -684,4 +687,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.49 2003/01/04 13:45:41 ballen4705 Exp $ +$Id: smartd.8,v 1.50 2003/01/04 19:31:38 pjwilliams Exp $ diff --git a/sm5/smartd.c b/sm5/smartd.c index a8c7728b2..3b4d4bb1d 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -50,7 +50,7 @@ // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid6="$Id: smartd.c,v 1.93 2003/01/04 17:34:16 pjwilliams Exp $" +const char *CVSid6="$Id: smartd.c,v 1.94 2003/01/04 19:31:38 pjwilliams Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; // global variable used for control of printing, passing arguments, etc. @@ -346,6 +346,8 @@ void Usage (void){ #ifdef HAVE_GETOPT_LONG printout(LOG_INFO,"Command Line Options:\n"); printout(LOG_INFO," -d, --debug\n Start smartd in debug mode\n\n"); + printout(LOG_INFO," -D, --showdirectives\n"); + printout(LOG_INFO," Print the configuration file Directives and exit\n\n"); printout(LOG_INFO," -i N, --interval=N\n"); printout(LOG_INFO," Set interval between disk checks to N seconds, where N >= 10\n\n"); printout(LOG_INFO," -V, --version, --license, --copyright\n"); @@ -354,14 +356,12 @@ void Usage (void){ #else printout(LOG_INFO,"Command Line Options:\n"); printout(LOG_INFO," -d Start smartd in debug mode\n"); + printout(LOG_INFO," -D Print the configuration file Directives and exit\n"); printout(LOG_INFO," -i N Set interval between disk checks to N seconds, where N >= 10\n"); printout(LOG_INFO," -V Print License, Copyright, and version information\n"); printout(LOG_INFO," -h Display this help and exit\n"); printout(LOG_INFO," -? Same as -h\n"); #endif - printout(LOG_INFO,"\n"); - printout(LOG_INFO,"Optional configuration file: %s\n",CONFIGFILE); - Directives(); } // returns negative if problem, else fd>=0 @@ -1432,18 +1432,19 @@ void ParseOpts(int argc, char **argv){ int optchar; char *tailptr; long lchecktime; - const char *shortopts = "di:Vh?"; + const char *shortopts = "dDi:Vh?"; #ifdef HAVE_GETOPT_LONG char *arg; struct option longopts[] = { - { "debug", no_argument, 0, 'd' }, - { "interval", required_argument, 0, 'i' }, - { "version", no_argument, 0, 'V' }, - { "license", no_argument, 0, 'V' }, - { "copyright", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'h' }, - { "usage", no_argument, 0, 'h' }, - { 0, 0, 0, 0 } + { "debug", no_argument, 0, 'd' }, + { "showdirectives", no_argument, 0, 'D' }, + { "interval", required_argument, 0, 'i' }, + { "version", no_argument, 0, 'V' }, + { "license", no_argument, 0, 'V' }, + { "copyright", no_argument, 0, 'V' }, + { "help", no_argument, 0, 'h' }, + { "usage", no_argument, 0, 'h' }, + { 0, 0, 0, 0 } }; #endif @@ -1459,6 +1460,11 @@ void ParseOpts(int argc, char **argv){ case 'd': debugmode = TRUE; break; + case 'D': + debugmode = TRUE; + Directives(); + exit(0); + break; case 'i': // Period (time interval) for checking // strtol will set errno in the event of overflow, so we'll check it. diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index bc5e32536..e994f204e 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -50,7 +50,7 @@ // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid6="$Id: smartd.cpp,v 1.93 2003/01/04 17:34:16 pjwilliams Exp $" +const char *CVSid6="$Id: smartd.cpp,v 1.94 2003/01/04 19:31:38 pjwilliams Exp $" CVSID1 CVSID2 CVSID3 CVSID4 CVSID7; // global variable used for control of printing, passing arguments, etc. @@ -346,6 +346,8 @@ void Usage (void){ #ifdef HAVE_GETOPT_LONG printout(LOG_INFO,"Command Line Options:\n"); printout(LOG_INFO," -d, --debug\n Start smartd in debug mode\n\n"); + printout(LOG_INFO," -D, --showdirectives\n"); + printout(LOG_INFO," Print the configuration file Directives and exit\n\n"); printout(LOG_INFO," -i N, --interval=N\n"); printout(LOG_INFO," Set interval between disk checks to N seconds, where N >= 10\n\n"); printout(LOG_INFO," -V, --version, --license, --copyright\n"); @@ -354,14 +356,12 @@ void Usage (void){ #else printout(LOG_INFO,"Command Line Options:\n"); printout(LOG_INFO," -d Start smartd in debug mode\n"); + printout(LOG_INFO," -D Print the configuration file Directives and exit\n"); printout(LOG_INFO," -i N Set interval between disk checks to N seconds, where N >= 10\n"); printout(LOG_INFO," -V Print License, Copyright, and version information\n"); printout(LOG_INFO," -h Display this help and exit\n"); printout(LOG_INFO," -? Same as -h\n"); #endif - printout(LOG_INFO,"\n"); - printout(LOG_INFO,"Optional configuration file: %s\n",CONFIGFILE); - Directives(); } // returns negative if problem, else fd>=0 @@ -1432,18 +1432,19 @@ void ParseOpts(int argc, char **argv){ int optchar; char *tailptr; long lchecktime; - const char *shortopts = "di:Vh?"; + const char *shortopts = "dDi:Vh?"; #ifdef HAVE_GETOPT_LONG char *arg; struct option longopts[] = { - { "debug", no_argument, 0, 'd' }, - { "interval", required_argument, 0, 'i' }, - { "version", no_argument, 0, 'V' }, - { "license", no_argument, 0, 'V' }, - { "copyright", no_argument, 0, 'V' }, - { "help", no_argument, 0, 'h' }, - { "usage", no_argument, 0, 'h' }, - { 0, 0, 0, 0 } + { "debug", no_argument, 0, 'd' }, + { "showdirectives", no_argument, 0, 'D' }, + { "interval", required_argument, 0, 'i' }, + { "version", no_argument, 0, 'V' }, + { "license", no_argument, 0, 'V' }, + { "copyright", no_argument, 0, 'V' }, + { "help", no_argument, 0, 'h' }, + { "usage", no_argument, 0, 'h' }, + { 0, 0, 0, 0 } }; #endif @@ -1459,6 +1460,11 @@ void ParseOpts(int argc, char **argv){ case 'd': debugmode = TRUE; break; + case 'D': + debugmode = TRUE; + Directives(); + exit(0); + break; case 'i': // Period (time interval) for checking // strtol will set errno in the event of overflow, so we'll check it. -- GitLab