]> git.proxmox.com Git - mirror_smartmontools-debian.git/commitdiff
Imported upstream version 5.38~cvs20071118
authorGuido Guenther <agx@sigxcpu.org>
Mon, 19 Nov 2007 12:17:31 +0000 (13:17 +0100)
committerGuido Guenther <agx@sigxcpu.org>
Mon, 19 Nov 2007 12:17:31 +0000 (13:17 +0100)
70 files changed:
.cvsignore [new file with mode: 0644]
AUTHORS
CHANGELOG
INSTALL
Makefile.am
Makefile.in [deleted file]
TODO
aclocal.m4 [deleted file]
atacmds.cpp
atacmds.h
ataprint.cpp
ataprint.h
autogen.sh
cciss.cpp [new file with mode: 0644]
cciss.h [new file with mode: 0644]
config.guess [deleted file]
config.h.in [deleted file]
config.h.in~ [new file with mode: 0644]
config.sub [deleted file]
configure [deleted file]
configure.in
depcomp [deleted file]
do_release [new file with mode: 0755]
examplescripts/.cvsignore [new file with mode: 0644]
examplescripts/Makefile.in
extern.h
install-sh [deleted file]
knowndrives.cpp
missing [deleted file]
os_darwin.cpp
os_darwin.h
os_darwin/SMART.in [changed mode: 0755->0644]
os_freebsd.cpp
os_freebsd.h
os_linux.cpp
os_linux.h
os_openbsd.cpp
os_os2.cpp [new file with mode: 0644]
os_os2.h [new file with mode: 0644]
os_os2/configure.os2 [new file with mode: 0644]
os_os2/hdreg.h [new file with mode: 0644]
os_qnxnto.cpp [new file with mode: 0644]
os_qnxnto.h [new file with mode: 0644]
os_solaris.cpp
os_win32.cpp
os_win32/.cvsignore [new file with mode: 0644]
os_win32/installer.nsi
os_win32/smartctl_vc6.dsp [new file with mode: 0644]
os_win32/smartd_vc6.dsp [new file with mode: 0644]
os_win32/smartmontools_vc6.dsw [new file with mode: 0644]
os_win32/syslogevt.c [new file with mode: 0644]
os_win32/syslogevt.mc [new file with mode: 0644]
os_win32/syslogevt_vc6.dsp [new file with mode: 0644]
posix/getopt.c [new file with mode: 0644]
posix/getopt.h [new file with mode: 0644]
posix/getopt1.c [new file with mode: 0644]
scsicmds.cpp
scsicmds.h
scsiprint.cpp
smartctl.8.in
smartctl.8.in.orig [new file with mode: 0644]
smartctl.cpp
smartd.8.in
smartd.8.in.orig [new file with mode: 0644]
smartd.conf.5.in
smartd.cpp
smartd.initd.in
smartmontools.spec
utility.cpp
utility.h

diff --git a/.cvsignore b/.cvsignore
new file mode 100644 (file)
index 0000000..85c60d8
--- /dev/null
@@ -0,0 +1,46 @@
+*.gz
+*.o
+*.rpm
+*.tar.gz
+*.tar.gz.asc
+*~
+.deps
+.gdb_history
+Makefile
+Makefile.in
+VERSION
+aclocal.m4
+add
+autom4te.cache
+autotools.diff
+build
+config.guess
+config.h
+config.h.in
+config.log
+config.status
+config.sub
+configure
+core
+cvs-script
+depcomp
+install-sh
+missing
+mkinstalldirs
+smartctl
+smartctl.8
+smartctl.1m
+smartctl.exe
+smartd
+smartd.8
+smartd.1m
+smartd.conf.5
+smartd.conf.4
+smartd.conf.sample
+smartd.initd
+smartd.exe
+stamp-h
+stamp-h.in
+stamp-h1
+writelog.c
+SMART
diff --git a/AUTHORS b/AUTHORS
index f781bf174bcba2b3487ed01373f76afe5ff6a32c..7b736453f1b6d662c3992da527d93fb275593c91 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -1,4 +1,4 @@
-$Id: AUTHORS,v 1.17 2006/12/20 12:24:34 guidog Exp $
+$Id: AUTHORS,v 1.18 2007/11/13 14:53:27 jhering Exp $
 
 This code was originally developed as a Senior Thesis by Michael
 Cornwell at the Concurrent Systems Laboratory (now part of the Storage
@@ -11,19 +11,19 @@ ucsc-smartsuite and smartsuite packages, and is derived from that code.
 Maintainers / Developers:
 
 Bruce Allen            <smartmontools-support@lists.sourceforge.net>
-Erik Inge Bolsø                <knan@mo.himolde.no>
+Erik Inge Bols              <knan@mo.himolde.no>
 Stanislav Brabec       <sbrabec@suse.cz>
 Peter Cassidy          <pcassidy@mac.com>
 Casper Dik             <casper@holland.sun.com>
 Christian Franke       <franke@computer.org>
-Guilhem Frézou         <guilhem.frezou@catii.fr>
+Guilhem Fr�zou               <guilhem.frezou@catii.fr>
 Douglas Gilbert                <dougg@torque.net>
 Guido Guenther         <agx@sigxcpu.org>
 Geoff Keating          <geoffk@geoffk.org>
 Dr. David Kirkby       <drkirkby@ntlworld.com>
-Kai Mäkisara           <kai.makisara@kolumbus.fi>
+Kai M�kisara         <kai.makisara@kolumbus.fi>
 Eduard Martinescu      <martines@rochester.rr.com>
-Frédéric L. W. Meunier <http://www.pervalidus.net/contact.html>
+Fr�d�ric L. W. Meunier     <http://www.pervalidus.net/contact.html>
 Keiji Sawada           <card_captor@users.sourceforge.net>
 David Snyder            <dasnyderx@yahoo.com>
 Sergey Svishchev       <svs@ropnet.ru>
@@ -32,3 +32,4 @@ Richard Zybert                <richard.zybert@zybert.co.uk>
 Yuri Dario             <mc6530@mclink.it>
 Shengfeng Zhou         <linux@highpoint-tech.com>
 Praveen Chidambaram    <bunchofmails@gmail.com>
+Joerg Hering            <hering.ruegen@gmx.de>
index f5fbcdd76fe5af9102a62b1061422d3d789bad1a..c9fe613596a2ca6de10a81189aeb42b8847c8361 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,26 +1,27 @@
 CHANGELOG for smartmontools
 
-$Id: CHANGELOG,v 1.592 2006/12/20 20:39:25 chrfranke Exp $
+$Id: CHANGELOG,v 1.637 2007/11/13 14:53:27 jhering Exp $
 
 The most recent version of this file is:
 http://smartmontools.cvs.sourceforge.net/smartmontools/sm5/CHANGELOG?view=markup
 
 Maintainers / Developers Key:
 [BA] Bruce Allen
-[EB] Erik Inge Bolsø
+[EB] Erik Inge Bols
 [SB] Stanislav Brabec
 [PC] Peter Cassidy
 [YD] Yuri Dario
 [CD] Casper Dik
 [CF] Christian Franke
-[GF] Guilhem Frézou
+[GF] Guilhem Frzou
 [DG] Douglas Gilbert
 [GG] Guido Guenther
 [GK] Geoff Keating
 [DK] Dr. David Kirkby
-[KM] Kai Mäkisara
+[JH] Joerg Hering
+[KM] Kai M�kisara
 [EM] Eduard Martinescu
-[FM] Frédéric L. W. Meunier
+[FM] Fr�d�ric L. W. Meunier
 [KS] Keiji Sawada
 [DS] David Snyder
 [SS] Sergey Svishchev
@@ -32,6 +33,156 @@ Maintainers / Developers Key:
 NOTES FOR FUTURE RELEASES: see TODO file.
 
 <DEVELOPERS: ADDITIONS TO THE CHANGE LOG GO JUST BELOW HERE, PLEASE>
+  [JH] initial porting to QNX Neutrino 6.3.2
+       need at this time a prerelease devb-eide driver and libcam.so.2
+       only tested for X86 Target, but devb-eide and lobcam.so.2 available for X86/ARM
+       the officional driver coming soon with the next QNX release
+       create two new source files os_qnxnto.[c..h]
+
+  [CF] smartd: Added option '-n, --no-fork' so that smartd works
+       better with modern init methods. Thanks to Enrico Scholz
+       for the patch from 2005-12-24.
+
+  [CF] Windows: Improved ATA/SCSI device type detection and
+       DEVICESCAN. This also fixes a regression in 3ware DEVICESCAN.
+
+  [CF] smartd: Don't start self tests in first pass to avoid
+       performance problems during boot.
+       https://bugzilla.novell.com/show_bug.cgi?id=192591
+
+  [CF] Fixed regression in SMART STATUS command on Win9x/ME.
+
+  [BA] Fixed 3ware issue with new controllers.  Documentation said
+       that one could address up to 24 disks on a single controller,
+       but in fact one was limited to 16 disks.  This is now fixed:
+       up to 32 disks can be addressed.  Thanks to Adam Radford.
+
+       NOTE1: I have patched the Linux and FreeBSD code but not
+       modified the Win32 code (it already supports up to 32 disks).
+
+       NOTE2: NOT TESTED ON LINUX.  Do not use this on a production box!
+       I will remove this NOTE2 as soon as some positive test
+       reports are recieved.
+
+       NOTE3: NOT TESTED ON FREEBSD. Do not use this on a production box!
+       I will remove this NOTE3 as soon as some positive test
+       reports are recieved.
+
+  [CF] Windows installer: Added explorer drive menu, CMD window,
+       UBCD4Win plugin, smartd service update and other minor
+       improvements.
+
+  [CF] Windows: Modified drive letter handling for explorer drive
+       context menu: try SCSI if type is unknown, allow 'X:\.' syntax.
+
+  [CF] Windows: Added automatic ATA/SCSI device type detection and
+       SCSI device scanning. The device names '/dev/sdX' and
+       '/dev/pd<n>' now work for both ATA and SCSI disks.
+
+  [CF] smartctl: Added ability to parse '-r ataioctl,2' output from
+       stdin ('-') and simulate the ATA commands for testing purposes.
+
+  [BA] SMART Attributes: added 187, 189, more accurate name for 190.
+
+  [CF] Windows: Added drive letters 'X:' as alternate disk device names.
+
+  [CF] smartctl: Added '-F swapid' to fix ATA identify string byte
+       ordering. Added '-q noserial' to suppress serial number output.
+
+  [CF] Windows: Added '/dev/n?st<n>' as alternate device names for SCSI
+       tapes. These names are also used by Cygwin's /dev emulation layer.
+       Thanks to Corinna Vinschen (Cygwin project lead) for pointing this
+       out. 
+
+  [CF] Windows: Added IOCTL_SCSI_MINIPORT_*SMART* for commands not handled
+       properly by SMART_IOCTL in disk class driver. This allows to use
+       READ_LOG, WRITE_LOG and ABORT_SELFTEST even if the driver does not
+       support ATA_PASS_THROUGH.
+
+  [CF] Added ATA-8 revision 4, fixed WRITE LOG '-r ioctl' output.
+
+  [BA] Updated smartctl and smartd so that they can be used with the latest
+       3ware controllers which have 24 ports.  Also updated docs.
+       Thanks to Tim Bell at CERN.
+
+  [GG] bit 4 in smartctl's return code might be set even when the dist check
+       didn't return "DISK OK"
+
+  [CF] Drive database: added '-F samsung3' for Samsung P80 firmware
+       BH100-35.
+
+  [SS] Applied patch from Dean Bennett to fix scheduled tests on 
+       Highpoint RAID controllers.
+
+  [BA] Added patch from Tejun Heo http://thread.gmane.org/gmane.linux.ide/13222/focus=13235
+       to fix broken auto-offline and auto-save via libata.  Very clean fix: does it
+       "the right way".  Thanks Tejun!
+
+  [CF] Added message text for ATA-7 self-test execution status 8
+       ("... handling damage").
+
+  [GG] cciss: support more than 16 disks (patch taken from
+       http://cciss.sourceforge.net/smartmontools_cciss_more_than_16_drives.patch
+       and adjusted for smartd)
+
+  [DG] Solaris: [SCSI] add USCSI_RQENABLE flag to uscsi pass-through so
+       sense buffer is made available. Expand reporting at this level.
+
+  [GK] Darwin: Improve handling of powered-down drives.
+
+  [SS] CCISS physical drive enumeration method changed (incompatibly).
+
+  [CF] Fixed smartd crash on missing '-s' directive argument.
+
+  [SS] Support CCISS on FreeBSD (kernel source is required).
+
+  [DG] SCSI/TAPE: some IBM tape drives don't react properly to a LOG
+       SENSE with an allocation length of 4; work around for that case.
+
+  [CF] Applied Guido's patch to fix CCISS LUN array bounds check
+       (openSUSE bug #239956) and remove trailing spaces in
+       os_linux.cpp.
+
+  [CF] Fixed 64-bit compilation issue in SCT status struct.
+
+  [DG] SAT/SCSI: make real SCSI disks visible to DEVICESCAN in
+       smartd again.
+
+  [CF] Fixed check of SCT temperature table size.
+
+  [CF] Added ATA-8 draft revisions, added SCT status format 3.
+
+  [CF] Drive database: added Samsung T166 series.
+
+  [CF] ATA: Added ',p' option for '-t scttempint,N' to make
+       setting persistent.
+
+  [CF] ATA: Added '-t scttempint,N' option to set SCT temperature
+       logging interval.
+
+  [CF] ATA: Added '-l scttemp[sts,hist]' options to print disk
+       temperature information and history table provided by
+       SMART Command Transport (SCT) Feature Set.
+
+  [CF] ATA: Added '-t selective,{redo,next,cont}' commands to
+       perform tests based on the last ranges still stored on
+       disk. Added 'N+SIZE' and 'N-max' format for LBA range
+       specification.
+
+  [CF] Added Min/Max Temperature format used in attribute 190 of
+       recent Maxtor disks (DiamondMax 20).
+
+  [CF] Linux: Added check for <linux/cciss_ioctl.h> to allow build
+       (without CCISS support) also when this file is missing.
+
+  [CF] Added -F samsung3 option to correct firmware bug reporting
+       completed self-tests as still in progress. Thanks to Manfred
+       Schwarb for the patch.
+
+  [CF] Added missing const specifiers (undetected by gcc 3.4 and 4.X)
+       to fix compilation with gcc 2.X.
+
+  [CF] Linux: compile fix for SuSE, config.h must be included first.
 
 smartmontools 5.37 Experimental Release
 
@@ -121,7 +272,7 @@ smartmontools 5.37 Experimental Release
        and T series.
 
   [GG] Add CCISS (Compaq Smart Array Controller) support with contributions
-       from Praveen Chidambaram, Douglas Gilbert, Guido Guenther and Frédéric
+       from Praveen Chidambaram, Douglas Gilbert, Guido Guenther and Fr�d�ric
        BOITEUX
 
   [PW] Drive database: added Hitachi Deskstar T7K250 and Hitachi
diff --git a/INSTALL b/INSTALL
index 9f00adb6902a6840f770abcc0401ccee513e838c..9f6bb689ac647461407b9258f7bdd5dc31b84212 100644 (file)
--- a/INSTALL
+++ b/INSTALL
@@ -1,7 +1,7 @@
 Smartmontools installation instructions
 =======================================
 
-$Id: INSTALL,v 1.72 2006/11/15 22:48:04 chrfranke Exp $
+$Id: INSTALL,v 1.73 2007/04/27 08:50:00 geoffk1 Exp $
 
 Please also see the smartmontools home page:
 http://smartmontools.sourceforge.net/
@@ -350,7 +350,7 @@ SuSE:
   If you'd like to build the i386 version on a powerpc machine, you can
   use
 
-  CC='gcc -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386' \
+  CXX='g++ -isysroot /Developer/SDKs/MacOSX10.4u.sdk -arch i386' \
     ./configure --host=i386-apple-darwin \
                --with-initscriptdir=/Library/StartupItems
 
index 185e83fd832a7000a950f934cf86a73ac597feca..dd3b1f73aac8874eb092b3520387a21acc8cb7f9 100644 (file)
@@ -1,6 +1,6 @@
 ## Process this file with automake to produce Makefile.in
 #
-# $Id: Makefile.am,v 1.80 2006/10/21 18:34:31 chrfranke Exp $
+# $Id: Makefile.am,v 1.81 2007/04/01 16:49:44 shattered Exp $
 #
 
 @SET_MAKE@
@@ -53,7 +53,9 @@ EXTRA_smartd_SOURCES = os_darwin.cpp    \
                        os_solaris_ata.s \
                        os_win32.cpp     \
                        os_generic.cpp   \
-                       os_generic.h
+                       os_generic.h     \
+                       cciss.cpp        \
+                       cciss.h
 
 
 if OS_WIN32_MINGW
@@ -113,7 +115,9 @@ EXTRA_smartctl_SOURCES = os_linux.cpp \
                        os_solaris.h   \
                        os_win32.cpp   \
                        os_generic.cpp \
-                       os_generic.h
+                       os_generic.h   \
+                       cciss.cpp      \
+                       cciss.h
 
 if OS_WIN32_MINGW
 
diff --git a/Makefile.in b/Makefile.in
deleted file mode 100644 (file)
index 4fbf405..0000000
+++ /dev/null
@@ -1,1395 +0,0 @@
-# Makefile.in generated by automake 1.9.6 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005  Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-#
-# $Id: Makefile.am,v 1.80 2006/10/21 18:34:31 chrfranke Exp $
-#
-
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = .
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-LIBOBJDIR =
-sbin_PROGRAMS = smartd$(EXEEXT) smartctl$(EXEEXT)
-@OS_WIN32_MINGW_TRUE@am__append_1 = \
-@OS_WIN32_MINGW_TRUE@                posix/regex.h               \
-@OS_WIN32_MINGW_TRUE@                posix/regex.c               \
-@OS_WIN32_MINGW_TRUE@                os_win32/daemon_win32.h     \
-@OS_WIN32_MINGW_TRUE@                os_win32/daemon_win32.cpp   \
-@OS_WIN32_MINGW_TRUE@                os_win32/hostname_win32.h   \
-@OS_WIN32_MINGW_TRUE@                os_win32/hostname_win32.cpp \
-@OS_WIN32_MINGW_TRUE@                os_win32/syslog.h           \
-@OS_WIN32_MINGW_TRUE@                os_win32/syslog_win32.cpp
-
-
-# Included by regex.c:
-@OS_WIN32_MINGW_TRUE@am__append_2 = \
-@OS_WIN32_MINGW_TRUE@                posix/regcomp.c           \
-@OS_WIN32_MINGW_TRUE@                posix/regexec.c           \
-@OS_WIN32_MINGW_TRUE@                posix/regex_internal.c    \
-@OS_WIN32_MINGW_TRUE@                posix/regex_internal.h
-
-@OS_WIN32_MINGW_TRUE@am__append_3 = \
-@OS_WIN32_MINGW_TRUE@                posix/regex.h          \
-@OS_WIN32_MINGW_TRUE@                posix/regex.c          \
-@OS_WIN32_MINGW_TRUE@                os_win32/syslog.h
-
-
-# Included by regex.c:
-@OS_WIN32_MINGW_TRUE@am__append_4 = \
-@OS_WIN32_MINGW_TRUE@                posix/regcomp.c        \
-@OS_WIN32_MINGW_TRUE@                posix/regexec.c        \
-@OS_WIN32_MINGW_TRUE@                posix/regex_internal.c \
-@OS_WIN32_MINGW_TRUE@                posix/regex_internal.h
-
-@SMARTD_SUFFIX_TRUE@am__append_5 = smartd.conf$(smartd_suffix)
-@OS_WIN32_MINGW_TRUE@am__append_6 = $(FILES_WIN32) $(exedir_win32)/syslogevt.exe distdir.mkdir syslogevt.check
-DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \
-       $(srcdir)/Makefile.in $(srcdir)/config.h.in \
-       $(top_srcdir)/configure AUTHORS COPYING INSTALL NEWS TODO \
-       config.guess config.sub depcomp install-sh missing
-subdir = .
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
-       $(ACLOCAL_M4)
-am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno configure.status.lineno
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES =
-am__installdirs = "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" \
-       "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(docsdir)" \
-       "$(DESTDIR)$(initddir)" "$(DESTDIR)$(sysconfdir)"
-sbinPROGRAMS_INSTALL = $(INSTALL_PROGRAM)
-PROGRAMS = $(sbin_PROGRAMS)
-am__smartctl_SOURCES_DIST = smartctl.cpp smartctl.h atacmdnames.cpp \
-       atacmdnames.h atacmds.cpp atacmds.h ataprint.cpp ataprint.h \
-       extern.h int64.h knowndrives.cpp knowndrives.h scsicmds.cpp \
-       scsicmds.h scsiata.cpp scsiata.h scsiprint.cpp scsiprint.h \
-       utility.cpp utility.h posix/regex.h posix/regex.c \
-       os_win32/syslog.h
-@OS_WIN32_MINGW_TRUE@am__objects_1 = regex.$(OBJEXT)
-am_smartctl_OBJECTS = smartctl.$(OBJEXT) atacmdnames.$(OBJEXT) \
-       atacmds.$(OBJEXT) ataprint.$(OBJEXT) knowndrives.$(OBJEXT) \
-       scsicmds.$(OBJEXT) scsiata.$(OBJEXT) scsiprint.$(OBJEXT) \
-       utility.$(OBJEXT) $(am__objects_1)
-am__EXTRA_smartctl_SOURCES_DIST = os_linux.cpp os_linux.h \
-       os_freebsd.cpp os_freebsd.h os_netbsd.cpp os_netbsd.h \
-       os_openbsd.cpp os_openbsd.h os_solaris.cpp os_solaris.h \
-       os_win32.cpp os_generic.cpp os_generic.h posix/regcomp.c \
-       posix/regexec.c posix/regex_internal.c posix/regex_internal.h
-smartctl_OBJECTS = $(am_smartctl_OBJECTS)
-am__smartd_SOURCES_DIST = smartd.cpp smartd.h atacmdnames.cpp \
-       atacmdnames.h atacmds.cpp atacmds.h ataprint.cpp ataprint.h \
-       extern.h int64.h knowndrives.cpp knowndrives.h scsicmds.cpp \
-       scsicmds.h scsiata.cpp scsiata.h scsiprint.cpp scsiprint.h \
-       utility.cpp utility.h posix/regex.h posix/regex.c \
-       os_win32/daemon_win32.h os_win32/daemon_win32.cpp \
-       os_win32/hostname_win32.h os_win32/hostname_win32.cpp \
-       os_win32/syslog.h os_win32/syslog_win32.cpp
-@OS_WIN32_MINGW_TRUE@am__objects_3 = regex.$(OBJEXT) \
-@OS_WIN32_MINGW_TRUE@  daemon_win32.$(OBJEXT) \
-@OS_WIN32_MINGW_TRUE@  hostname_win32.$(OBJEXT) \
-@OS_WIN32_MINGW_TRUE@  syslog_win32.$(OBJEXT)
-am_smartd_OBJECTS = smartd.$(OBJEXT) atacmdnames.$(OBJEXT) \
-       atacmds.$(OBJEXT) ataprint.$(OBJEXT) knowndrives.$(OBJEXT) \
-       scsicmds.$(OBJEXT) scsiata.$(OBJEXT) scsiprint.$(OBJEXT) \
-       utility.$(OBJEXT) $(am__objects_3)
-am__EXTRA_smartd_SOURCES_DIST = os_darwin.cpp os_darwin.h os_linux.cpp \
-       os_linux.h os_freebsd.cpp os_freebsd.h os_netbsd.cpp \
-       os_netbsd.h os_openbsd.cpp os_openbsd.h os_solaris.cpp \
-       os_solaris.h os_solaris_ata.s os_win32.cpp os_generic.cpp \
-       os_generic.h posix/regcomp.c posix/regexec.c \
-       posix/regex_internal.c posix/regex_internal.h
-smartd_OBJECTS = $(am_smartd_OBJECTS)
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
-       $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
-CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
-       $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-CXXLD = $(CXX)
-CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-       -o $@
-CCASCOMPILE = $(CCAS) $(AM_CCASFLAGS) $(CCASFLAGS)
-SOURCES = $(smartctl_SOURCES) $(EXTRA_smartctl_SOURCES) \
-       $(smartd_SOURCES) $(EXTRA_smartd_SOURCES)
-DIST_SOURCES = $(am__smartctl_SOURCES_DIST) \
-       $(am__EXTRA_smartctl_SOURCES_DIST) $(am__smartd_SOURCES_DIST) \
-       $(am__EXTRA_smartd_SOURCES_DIST)
-RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
-       html-recursive info-recursive install-data-recursive \
-       install-exec-recursive install-info-recursive \
-       install-recursive installcheck-recursive installdirs-recursive \
-       pdf-recursive ps-recursive uninstall-info-recursive \
-       uninstall-recursive
-man5dir = $(mandir)/man5
-man8dir = $(mandir)/man8
-NROFF = nroff
-MANS = $(man_MANS)
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
-    $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
-    *) f=$$p;; \
-  esac;
-am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
-docsDATA_INSTALL = $(INSTALL_DATA)
-initdDATA_INSTALL = $(INSTALL_DATA)
-sysconfDATA_INSTALL = $(INSTALL_DATA)
-DATA = $(docs_DATA) $(initd_DATA) $(sysconf_DATA)
-ETAGS = etags
-CTAGS = ctags
-DIST_SUBDIRS = $(SUBDIRS)
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-distdir = $(PACKAGE)-$(VERSION)
-top_distdir = $(distdir)
-am__remove_distdir = \
-  { test ! -d $(distdir) \
-    || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
-         && rm -fr $(distdir); }; }
-DIST_ARCHIVES = $(distdir).tar.gz
-GZIP_ENV = --best
-distuninstallcheck_listfiles = find . -type f -print
-distcleancheck_listfiles = find . -type f -print
-ACLOCAL = @ACLOCAL@
-AMDEP_FALSE = @AMDEP_FALSE@
-AMDEP_TRUE = @AMDEP_TRUE@
-AMTAR = @AMTAR@
-ASFLAGS = @ASFLAGS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCAS = @CCAS@
-CCASFLAGS = @CCASFLAGS@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPPFLAGS = @CPPFLAGS@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXDEPMODE = @CXXDEPMODE@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-GREP = @GREP@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
-MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
-MAKEINFO = @MAKEINFO@
-OBJEXT = @OBJEXT@
-OS_DARWIN_FALSE = @OS_DARWIN_FALSE@
-OS_DARWIN_TRUE = @OS_DARWIN_TRUE@
-OS_SOLARIS_FALSE = @OS_SOLARIS_FALSE@
-OS_SOLARIS_TRUE = @OS_SOLARIS_TRUE@
-OS_WIN32_MINGW_FALSE = @OS_WIN32_MINGW_FALSE@
-OS_WIN32_MINGW_TRUE = @OS_WIN32_MINGW_TRUE@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SMARTD_SUFFIX_FALSE = @SMARTD_SUFFIX_FALSE@
-SMARTD_SUFFIX_TRUE = @SMARTD_SUFFIX_TRUE@
-STRIP = @STRIP@
-VERSION = @VERSION@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-am__fastdepCC_FALSE = @am__fastdepCC_FALSE@
-am__fastdepCC_TRUE = @am__fastdepCC_TRUE@
-am__fastdepCXX_FALSE = @am__fastdepCXX_FALSE@
-am__fastdepCXX_TRUE = @am__fastdepCXX_TRUE@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exampledir = @exampledir@
-exec_prefix = @exec_prefix@
-gcc_have_attr_packed = @gcc_have_attr_packed@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-initddir = @initddir@
-install_sh = @install_sh@
-libc_have_working_snprintf = @libc_have_working_snprintf@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-os_deps = @os_deps@
-os_libs = @os_libs@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-releaseversion = @releaseversion@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-smartd_suffix = @smartd_suffix@
-smartmontools_release_date = @smartmontools_release_date@
-smartmontools_release_time = @smartmontools_release_time@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-
-# Make sure .cpp takes precedence to avoid compiling old .c file
-SUFFIXES = .cpp .c .s .o
-AM_CPPFLAGS = -DSMARTMONTOOLS_SYSCONFDIR=\"$(sysconfdir)\"
-smartd_SOURCES = smartd.cpp smartd.h atacmdnames.cpp atacmdnames.h \
-       atacmds.cpp atacmds.h ataprint.cpp ataprint.h extern.h int64.h \
-       knowndrives.cpp knowndrives.h scsicmds.cpp scsicmds.h \
-       scsiata.cpp scsiata.h scsiprint.cpp scsiprint.h utility.cpp \
-       utility.h $(am__append_1)
-smartd_LDADD = @os_deps@ @os_libs@
-smartd_DEPENDENCIES = @os_deps@
-EXTRA_smartd_SOURCES = os_darwin.cpp os_darwin.h os_linux.cpp \
-       os_linux.h os_freebsd.cpp os_freebsd.h os_netbsd.cpp \
-       os_netbsd.h os_openbsd.cpp os_openbsd.h os_solaris.cpp \
-       os_solaris.h os_solaris_ata.s os_win32.cpp os_generic.cpp \
-       os_generic.h $(am__append_2)
-smartctl_SOURCES = smartctl.cpp smartctl.h atacmdnames.cpp \
-       atacmdnames.h atacmds.cpp atacmds.h ataprint.cpp ataprint.h \
-       extern.h int64.h knowndrives.cpp knowndrives.h scsicmds.cpp \
-       scsicmds.h scsiata.cpp scsiata.h scsiprint.cpp scsiprint.h \
-       utility.cpp utility.h $(am__append_3)
-smartctl_LDADD = @os_deps@ @os_libs@
-smartctl_DEPENDENCIES = @os_deps@
-EXTRA_smartctl_SOURCES = os_linux.cpp os_linux.h os_freebsd.cpp \
-       os_freebsd.h os_netbsd.cpp os_netbsd.h os_openbsd.cpp \
-       os_openbsd.h os_solaris.cpp os_solaris.h os_win32.cpp \
-       os_generic.cpp os_generic.h $(am__append_4)
-
-# This block is required because Solaris uses manual page section 1m
-# for administrative command (linux/freebsd use section 8) and Solaris
-# uses manual page section 4 for file formats (linux/freebsd use
-# section 5).  Automake can deal cleanly with man page sections 1-8
-# and n, but NOT with sections of the form 1m.
-@OS_SOLARIS_TRUE@extra_MANS = smartd.conf.4 \
-@OS_SOLARIS_TRUE@                  smartctl.1m   \
-@OS_SOLARIS_TRUE@                  smartd.1m
-
-# For systems that adopts traditional manner
-@OS_SOLARIS_FALSE@man_MANS = smartd.conf.5 \
-@OS_SOLARIS_FALSE@                  smartctl.8    \
-@OS_SOLARIS_FALSE@                  smartd.8
-
-docsdir = $(docdir)
-docs_DATA = AUTHORS     \
-            CHANGELOG   \
-            COPYING     \
-            INSTALL     \
-            NEWS        \
-            README      \
-            TODO        \
-            WARNINGS    \
-            smartd.conf
-
-sysconf_DATA = smartd.conf$(smartd_suffix)
-EXTRA_DIST = smartmontools.spec                    \
-             smartd.initd.in                       \
-             smartd.8.in                           \
-             smartctl.8.in                         \
-             smartd.conf.5.in                      \
-             smartd.conf                           \
-             autogen.sh                            \
-             os_darwin/SMART.in                    \
-             os_darwin/StartupParameters.plist     \
-             os_darwin/English_Localizable.strings \
-             os_win32/installer.nsi                \
-             $(docs_DATA)
-
-CLEANFILES = smartd.conf.5 smartd.conf.4 smartd.8 smartd.1m \
-       smartd.8.html smartd.8.txt smartctl.8 smartctl.1m \
-       smartctl.8.html smartctl.8.txt smartd.conf.5.html \
-       smartd.conf.5.txt smartd.initd SMART $(am__append_5) \
-       $(am__append_6)
-@OS_DARWIN_FALSE@initd_DATA = smartd.initd
-@OS_DARWIN_TRUE@initd_DATA = SMART                            \
-@OS_DARWIN_TRUE@       os_darwin/StartupParameters.plist     \
-@OS_DARWIN_TRUE@       os_darwin/English_Localizable.strings
-
-@OS_DARWIN_FALSE@initd_install_name = smartd$(smartd_suffix)
-@OS_DARWIN_TRUE@initd_install_name = SMART
-@OS_DARWIN_FALSE@initd_DATA_install = install-initdDATA-generic
-@OS_DARWIN_TRUE@initd_DATA_install = install-initdDATA-darwin
-
-# Commands to convert man pages into .html and .txt
-# TODO: configure
-MAN2HTML = man2html
-#MAN2HTML = groff -man -Thtml
-MAN2TXT = groff -man -Tascii -P'-bcou'
-
-# Remove HTTP header and fix links in man2html output
-FIXHTML = sed '1s,^Content-type.*,,' \
-        | sed 's,<A HREF="http://[-a-z/]*/man2html?\([1-8]\)+\(smart[cd][.a-z]*\)">,<A HREF="\2.\1.html">,g' \
-        | sed 's,<A HREF="http://[-a-z/]*/man2html">,<A HREF=".">,g' \
-        | sed 's,<A HREF="http://[-a-z/]*/man2html?[^"]*">\([^<]*\)</A>,\1,g' \
-        | sed 's,<A HREF="mailto:[^s][^m][^a][^"]*">\([^<]*\)</A>,\1,g'
-
-
-# Definitions for Windows distribution
-@OS_WIN32_MINGW_TRUE@distdir_win32 = $(PACKAGE)-$(VERSION).win32
-@OS_WIN32_MINGW_TRUE@distzip_win32 = $(PACKAGE)-$(VERSION).win32.zip
-@OS_WIN32_MINGW_TRUE@distinst_win32 = $(PACKAGE)-$(VERSION).win32-setup.exe
-@OS_WIN32_MINGW_TRUE@exedir_win32 = $(distdir_win32)/bin
-@OS_WIN32_MINGW_TRUE@docdir_win32 = $(distdir_win32)/doc
-@OS_WIN32_MINGW_TRUE@FILES_WIN32 = $(exedir_win32)/smartctl.exe \
-@OS_WIN32_MINGW_TRUE@              $(exedir_win32)/smartd.exe \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/AUTHORS.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/CHANGELOG.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/COPYING.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/INSTALL.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/NEWS.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/README.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/TODO.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/WARNINGS.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/smartd.conf \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/smartctl.8.html \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/smartctl.8.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/smartd.8.html \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/smartd.8.txt \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/smartd.conf.5.html \
-@OS_WIN32_MINGW_TRUE@              $(docdir_win32)/smartd.conf.5.txt
-
-
-# Textfile converter from cygutils
-@OS_WIN32_MINGW_TRUE@UNIX2DOS = unix2dos -D
-@OS_WIN32_MINGW_TRUE@DOS2UNIX = dos2unix -U
-SUBDIRS = . examplescripts
-all: config.h
-       $(MAKE) $(AM_MAKEFLAGS) all-recursive
-
-.SUFFIXES:
-.SUFFIXES: .cpp .c .s .o .obj
-am--refresh:
-       @:
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am  $(am__configure_deps)
-       @for dep in $?; do \
-         case '$(am__configure_deps)' in \
-           *$$dep*) \
-             echo ' cd $(srcdir) && $(AUTOMAKE) --foreign '; \
-             cd $(srcdir) && $(AUTOMAKE) --foreign  \
-               && exit 0; \
-             exit 1;; \
-         esac; \
-       done; \
-       echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign  Makefile'; \
-       cd $(top_srcdir) && \
-         $(AUTOMAKE) --foreign  Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
-       @case '$?' in \
-         *config.status*) \
-           echo ' $(SHELL) ./config.status'; \
-           $(SHELL) ./config.status;; \
-         *) \
-           echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
-           cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
-       esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
-       $(SHELL) ./config.status --recheck
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
-       cd $(srcdir) && $(AUTOCONF)
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
-       cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-
-config.h: stamp-h1
-       @if test ! -f $@; then \
-         rm -f stamp-h1; \
-         $(MAKE) stamp-h1; \
-       else :; fi
-
-stamp-h1: $(srcdir)/config.h.in $(top_builddir)/config.status
-       @rm -f stamp-h1
-       cd $(top_builddir) && $(SHELL) ./config.status config.h
-$(srcdir)/config.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) 
-       cd $(top_srcdir) && $(AUTOHEADER)
-       rm -f stamp-h1
-       touch $@
-
-distclean-hdr:
-       -rm -f config.h stamp-h1
-install-sbinPROGRAMS: $(sbin_PROGRAMS)
-       @$(NORMAL_INSTALL)
-       test -z "$(sbindir)" || $(mkdir_p) "$(DESTDIR)$(sbindir)"
-       @list='$(sbin_PROGRAMS)'; for p in $$list; do \
-         p1=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
-         if test -f $$p \
-         ; then \
-           f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \
-          echo " $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) '$$p' '$(DESTDIR)$(sbindir)/$$f'"; \
-          $(INSTALL_PROGRAM_ENV) $(sbinPROGRAMS_INSTALL) "$$p" "$(DESTDIR)$(sbindir)/$$f" || exit 1; \
-         else :; fi; \
-       done
-
-uninstall-sbinPROGRAMS:
-       @$(NORMAL_UNINSTALL)
-       @list='$(sbin_PROGRAMS)'; for p in $$list; do \
-         f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \
-         echo " rm -f '$(DESTDIR)$(sbindir)/$$f'"; \
-         rm -f "$(DESTDIR)$(sbindir)/$$f"; \
-       done
-
-clean-sbinPROGRAMS:
-       -test -z "$(sbin_PROGRAMS)" || rm -f $(sbin_PROGRAMS)
-smartctl$(EXEEXT): $(smartctl_OBJECTS) $(smartctl_DEPENDENCIES) 
-       @rm -f smartctl$(EXEEXT)
-       $(CXXLINK) $(smartctl_LDFLAGS) $(smartctl_OBJECTS) $(smartctl_LDADD) $(LIBS)
-smartd$(EXEEXT): $(smartd_OBJECTS) $(smartd_DEPENDENCIES) 
-       @rm -f smartd$(EXEEXT)
-       $(CXXLINK) $(smartd_LDFLAGS) $(smartd_OBJECTS) $(smartd_LDADD) $(LIBS)
-
-mostlyclean-compile:
-       -rm -f *.$(OBJEXT)
-
-distclean-compile:
-       -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atacmdnames.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/atacmds.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ataprint.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/daemon_win32.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/hostname_win32.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/knowndrives.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_darwin.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_freebsd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_generic.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_linux.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_netbsd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_openbsd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_solaris.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/os_win32.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regcomp.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regex_internal.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/regexec.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scsiata.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scsicmds.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/scsiprint.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smartctl.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/smartd.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syslog_win32.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/utility.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@   if $(COMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-regex.o: posix/regex.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT regex.o -MD -MP -MF "$(DEPDIR)/regex.Tpo" -c -o regex.o `test -f 'posix/regex.c' || echo '$(srcdir)/'`posix/regex.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/regex.Tpo" "$(DEPDIR)/regex.Po"; else rm -f "$(DEPDIR)/regex.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='posix/regex.c' object='regex.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o regex.o `test -f 'posix/regex.c' || echo '$(srcdir)/'`posix/regex.c
-
-regex.obj: posix/regex.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT regex.obj -MD -MP -MF "$(DEPDIR)/regex.Tpo" -c -o regex.obj `if test -f 'posix/regex.c'; then $(CYGPATH_W) 'posix/regex.c'; else $(CYGPATH_W) '$(srcdir)/posix/regex.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/regex.Tpo" "$(DEPDIR)/regex.Po"; else rm -f "$(DEPDIR)/regex.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='posix/regex.c' object='regex.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o regex.obj `if test -f 'posix/regex.c'; then $(CYGPATH_W) 'posix/regex.c'; else $(CYGPATH_W) '$(srcdir)/posix/regex.c'; fi`
-
-regcomp.o: posix/regcomp.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT regcomp.o -MD -MP -MF "$(DEPDIR)/regcomp.Tpo" -c -o regcomp.o `test -f 'posix/regcomp.c' || echo '$(srcdir)/'`posix/regcomp.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/regcomp.Tpo" "$(DEPDIR)/regcomp.Po"; else rm -f "$(DEPDIR)/regcomp.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='posix/regcomp.c' object='regcomp.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o regcomp.o `test -f 'posix/regcomp.c' || echo '$(srcdir)/'`posix/regcomp.c
-
-regcomp.obj: posix/regcomp.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT regcomp.obj -MD -MP -MF "$(DEPDIR)/regcomp.Tpo" -c -o regcomp.obj `if test -f 'posix/regcomp.c'; then $(CYGPATH_W) 'posix/regcomp.c'; else $(CYGPATH_W) '$(srcdir)/posix/regcomp.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/regcomp.Tpo" "$(DEPDIR)/regcomp.Po"; else rm -f "$(DEPDIR)/regcomp.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='posix/regcomp.c' object='regcomp.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o regcomp.obj `if test -f 'posix/regcomp.c'; then $(CYGPATH_W) 'posix/regcomp.c'; else $(CYGPATH_W) '$(srcdir)/posix/regcomp.c'; fi`
-
-regexec.o: posix/regexec.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT regexec.o -MD -MP -MF "$(DEPDIR)/regexec.Tpo" -c -o regexec.o `test -f 'posix/regexec.c' || echo '$(srcdir)/'`posix/regexec.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/regexec.Tpo" "$(DEPDIR)/regexec.Po"; else rm -f "$(DEPDIR)/regexec.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='posix/regexec.c' object='regexec.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o regexec.o `test -f 'posix/regexec.c' || echo '$(srcdir)/'`posix/regexec.c
-
-regexec.obj: posix/regexec.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT regexec.obj -MD -MP -MF "$(DEPDIR)/regexec.Tpo" -c -o regexec.obj `if test -f 'posix/regexec.c'; then $(CYGPATH_W) 'posix/regexec.c'; else $(CYGPATH_W) '$(srcdir)/posix/regexec.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/regexec.Tpo" "$(DEPDIR)/regexec.Po"; else rm -f "$(DEPDIR)/regexec.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='posix/regexec.c' object='regexec.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o regexec.obj `if test -f 'posix/regexec.c'; then $(CYGPATH_W) 'posix/regexec.c'; else $(CYGPATH_W) '$(srcdir)/posix/regexec.c'; fi`
-
-regex_internal.o: posix/regex_internal.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT regex_internal.o -MD -MP -MF "$(DEPDIR)/regex_internal.Tpo" -c -o regex_internal.o `test -f 'posix/regex_internal.c' || echo '$(srcdir)/'`posix/regex_internal.c; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/regex_internal.Tpo" "$(DEPDIR)/regex_internal.Po"; else rm -f "$(DEPDIR)/regex_internal.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='posix/regex_internal.c' object='regex_internal.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o regex_internal.o `test -f 'posix/regex_internal.c' || echo '$(srcdir)/'`posix/regex_internal.c
-
-regex_internal.obj: posix/regex_internal.c
-@am__fastdepCC_TRUE@   if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT regex_internal.obj -MD -MP -MF "$(DEPDIR)/regex_internal.Tpo" -c -o regex_internal.obj `if test -f 'posix/regex_internal.c'; then $(CYGPATH_W) 'posix/regex_internal.c'; else $(CYGPATH_W) '$(srcdir)/posix/regex_internal.c'; fi`; \
-@am__fastdepCC_TRUE@   then mv -f "$(DEPDIR)/regex_internal.Tpo" "$(DEPDIR)/regex_internal.Po"; else rm -f "$(DEPDIR)/regex_internal.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      source='posix/regex_internal.c' object='regex_internal.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@      DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@  $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o regex_internal.obj `if test -f 'posix/regex_internal.c'; then $(CYGPATH_W) 'posix/regex_internal.c'; else $(CYGPATH_W) '$(srcdir)/posix/regex_internal.c'; fi`
-
-.cpp.o:
-@am__fastdepCXX_TRUE@  if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ $<; \
-@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $<
-
-.cpp.obj:
-@am__fastdepCXX_TRUE@  if $(CXXCOMPILE) -MT $@ -MD -MP -MF "$(DEPDIR)/$*.Tpo" -c -o $@ `$(CYGPATH_W) '$<'`; \
-@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/$*.Tpo" "$(DEPDIR)/$*.Po"; else rm -f "$(DEPDIR)/$*.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
-
-daemon_win32.o: os_win32/daemon_win32.cpp
-@am__fastdepCXX_TRUE@  if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT daemon_win32.o -MD -MP -MF "$(DEPDIR)/daemon_win32.Tpo" -c -o daemon_win32.o `test -f 'os_win32/daemon_win32.cpp' || echo '$(srcdir)/'`os_win32/daemon_win32.cpp; \
-@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/daemon_win32.Tpo" "$(DEPDIR)/daemon_win32.Po"; else rm -f "$(DEPDIR)/daemon_win32.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='os_win32/daemon_win32.cpp' object='daemon_win32.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o daemon_win32.o `test -f 'os_win32/daemon_win32.cpp' || echo '$(srcdir)/'`os_win32/daemon_win32.cpp
-
-daemon_win32.obj: os_win32/daemon_win32.cpp
-@am__fastdepCXX_TRUE@  if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT daemon_win32.obj -MD -MP -MF "$(DEPDIR)/daemon_win32.Tpo" -c -o daemon_win32.obj `if test -f 'os_win32/daemon_win32.cpp'; then $(CYGPATH_W) 'os_win32/daemon_win32.cpp'; else $(CYGPATH_W) '$(srcdir)/os_win32/daemon_win32.cpp'; fi`; \
-@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/daemon_win32.Tpo" "$(DEPDIR)/daemon_win32.Po"; else rm -f "$(DEPDIR)/daemon_win32.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='os_win32/daemon_win32.cpp' object='daemon_win32.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o daemon_win32.obj `if test -f 'os_win32/daemon_win32.cpp'; then $(CYGPATH_W) 'os_win32/daemon_win32.cpp'; else $(CYGPATH_W) '$(srcdir)/os_win32/daemon_win32.cpp'; fi`
-
-hostname_win32.o: os_win32/hostname_win32.cpp
-@am__fastdepCXX_TRUE@  if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hostname_win32.o -MD -MP -MF "$(DEPDIR)/hostname_win32.Tpo" -c -o hostname_win32.o `test -f 'os_win32/hostname_win32.cpp' || echo '$(srcdir)/'`os_win32/hostname_win32.cpp; \
-@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/hostname_win32.Tpo" "$(DEPDIR)/hostname_win32.Po"; else rm -f "$(DEPDIR)/hostname_win32.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='os_win32/hostname_win32.cpp' object='hostname_win32.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hostname_win32.o `test -f 'os_win32/hostname_win32.cpp' || echo '$(srcdir)/'`os_win32/hostname_win32.cpp
-
-hostname_win32.obj: os_win32/hostname_win32.cpp
-@am__fastdepCXX_TRUE@  if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT hostname_win32.obj -MD -MP -MF "$(DEPDIR)/hostname_win32.Tpo" -c -o hostname_win32.obj `if test -f 'os_win32/hostname_win32.cpp'; then $(CYGPATH_W) 'os_win32/hostname_win32.cpp'; else $(CYGPATH_W) '$(srcdir)/os_win32/hostname_win32.cpp'; fi`; \
-@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/hostname_win32.Tpo" "$(DEPDIR)/hostname_win32.Po"; else rm -f "$(DEPDIR)/hostname_win32.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='os_win32/hostname_win32.cpp' object='hostname_win32.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o hostname_win32.obj `if test -f 'os_win32/hostname_win32.cpp'; then $(CYGPATH_W) 'os_win32/hostname_win32.cpp'; else $(CYGPATH_W) '$(srcdir)/os_win32/hostname_win32.cpp'; fi`
-
-syslog_win32.o: os_win32/syslog_win32.cpp
-@am__fastdepCXX_TRUE@  if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT syslog_win32.o -MD -MP -MF "$(DEPDIR)/syslog_win32.Tpo" -c -o syslog_win32.o `test -f 'os_win32/syslog_win32.cpp' || echo '$(srcdir)/'`os_win32/syslog_win32.cpp; \
-@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/syslog_win32.Tpo" "$(DEPDIR)/syslog_win32.Po"; else rm -f "$(DEPDIR)/syslog_win32.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='os_win32/syslog_win32.cpp' object='syslog_win32.o' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o syslog_win32.o `test -f 'os_win32/syslog_win32.cpp' || echo '$(srcdir)/'`os_win32/syslog_win32.cpp
-
-syslog_win32.obj: os_win32/syslog_win32.cpp
-@am__fastdepCXX_TRUE@  if $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -MT syslog_win32.obj -MD -MP -MF "$(DEPDIR)/syslog_win32.Tpo" -c -o syslog_win32.obj `if test -f 'os_win32/syslog_win32.cpp'; then $(CYGPATH_W) 'os_win32/syslog_win32.cpp'; else $(CYGPATH_W) '$(srcdir)/os_win32/syslog_win32.cpp'; fi`; \
-@am__fastdepCXX_TRUE@  then mv -f "$(DEPDIR)/syslog_win32.Tpo" "$(DEPDIR)/syslog_win32.Po"; else rm -f "$(DEPDIR)/syslog_win32.Tpo"; exit 1; fi
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     source='os_win32/syslog_win32.cpp' object='syslog_win32.obj' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCXX_FALSE@     DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o syslog_win32.obj `if test -f 'os_win32/syslog_win32.cpp'; then $(CYGPATH_W) 'os_win32/syslog_win32.cpp'; else $(CYGPATH_W) '$(srcdir)/os_win32/syslog_win32.cpp'; fi`
-
-.s.o:
-       $(CCASCOMPILE) -c $<
-
-.s.obj:
-       $(CCASCOMPILE) -c `$(CYGPATH_W) '$<'`
-uninstall-info-am:
-install-man5: $(man5_MANS) $(man_MANS)
-       @$(NORMAL_INSTALL)
-       test -z "$(man5dir)" || $(mkdir_p) "$(DESTDIR)$(man5dir)"
-       @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
-       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-       for i in $$l2; do \
-         case "$$i" in \
-           *.5*) list="$$list $$i" ;; \
-         esac; \
-       done; \
-       for i in $$list; do \
-         if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
-         else file=$$i; fi; \
-         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-         case "$$ext" in \
-           5*) ;; \
-           *) ext='5' ;; \
-         esac; \
-         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-         inst=`echo $$inst | sed -e 's/^.*\///'`; \
-         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-         echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man5dir)/$$inst'"; \
-         $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man5dir)/$$inst"; \
-       done
-uninstall-man5:
-       @$(NORMAL_UNINSTALL)
-       @list='$(man5_MANS) $(dist_man5_MANS) $(nodist_man5_MANS)'; \
-       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-       for i in $$l2; do \
-         case "$$i" in \
-           *.5*) list="$$list $$i" ;; \
-         esac; \
-       done; \
-       for i in $$list; do \
-         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-         case "$$ext" in \
-           5*) ;; \
-           *) ext='5' ;; \
-         esac; \
-         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-         inst=`echo $$inst | sed -e 's/^.*\///'`; \
-         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-         echo " rm -f '$(DESTDIR)$(man5dir)/$$inst'"; \
-         rm -f "$(DESTDIR)$(man5dir)/$$inst"; \
-       done
-install-man8: $(man8_MANS) $(man_MANS)
-       @$(NORMAL_INSTALL)
-       test -z "$(man8dir)" || $(mkdir_p) "$(DESTDIR)$(man8dir)"
-       @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
-       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-       for i in $$l2; do \
-         case "$$i" in \
-           *.8*) list="$$list $$i" ;; \
-         esac; \
-       done; \
-       for i in $$list; do \
-         if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
-         else file=$$i; fi; \
-         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-         case "$$ext" in \
-           8*) ;; \
-           *) ext='8' ;; \
-         esac; \
-         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-         inst=`echo $$inst | sed -e 's/^.*\///'`; \
-         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-         echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man8dir)/$$inst'"; \
-         $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man8dir)/$$inst"; \
-       done
-uninstall-man8:
-       @$(NORMAL_UNINSTALL)
-       @list='$(man8_MANS) $(dist_man8_MANS) $(nodist_man8_MANS)'; \
-       l2='$(man_MANS) $(dist_man_MANS) $(nodist_man_MANS)'; \
-       for i in $$l2; do \
-         case "$$i" in \
-           *.8*) list="$$list $$i" ;; \
-         esac; \
-       done; \
-       for i in $$list; do \
-         ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-         case "$$ext" in \
-           8*) ;; \
-           *) ext='8' ;; \
-         esac; \
-         inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-         inst=`echo $$inst | sed -e 's/^.*\///'`; \
-         inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-         echo " rm -f '$(DESTDIR)$(man8dir)/$$inst'"; \
-         rm -f "$(DESTDIR)$(man8dir)/$$inst"; \
-       done
-install-docsDATA: $(docs_DATA)
-       @$(NORMAL_INSTALL)
-       test -z "$(docsdir)" || $(mkdir_p) "$(DESTDIR)$(docsdir)"
-       @list='$(docs_DATA)'; for p in $$list; do \
-         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         f=$(am__strip_dir) \
-         echo " $(docsDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(docsdir)/$$f'"; \
-         $(docsDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(docsdir)/$$f"; \
-       done
-install-sysconfDATA: $(sysconf_DATA)
-       @$(NORMAL_INSTALL)
-       test -z "$(sysconfdir)" || $(mkdir_p) "$(DESTDIR)$(sysconfdir)"
-       @list='$(sysconf_DATA)'; for p in $$list; do \
-         if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
-         f=$(am__strip_dir) \
-         echo " $(sysconfDATA_INSTALL) '$$d$$p' '$(DESTDIR)$(sysconfdir)/$$f'"; \
-         $(sysconfDATA_INSTALL) "$$d$$p" "$(DESTDIR)$(sysconfdir)/$$f"; \
-       done
-
-uninstall-sysconfDATA:
-       @$(NORMAL_UNINSTALL)
-       @list='$(sysconf_DATA)'; for p in $$list; do \
-         f=$(am__strip_dir) \
-         echo " rm -f '$(DESTDIR)$(sysconfdir)/$$f'"; \
-         rm -f "$(DESTDIR)$(sysconfdir)/$$f"; \
-       done
-
-# This directory's subdirectories are mostly independent; you can cd
-# into them and run `make' without going through this Makefile.
-# To change the values of `make' variables: instead of editing Makefiles,
-# (1) if the variable is set in `config.status', edit `config.status'
-#     (which will cause the Makefiles to be regenerated when you run `make');
-# (2) otherwise, pass the desired values on the `make' command line.
-$(RECURSIVE_TARGETS):
-       @failcom='exit 1'; \
-       for f in x $$MAKEFLAGS; do \
-         case $$f in \
-           *=* | --[!k]*);; \
-           *k*) failcom='fail=yes';; \
-         esac; \
-       done; \
-       dot_seen=no; \
-       target=`echo $@ | sed s/-recursive//`; \
-       list='$(SUBDIRS)'; for subdir in $$list; do \
-         echo "Making $$target in $$subdir"; \
-         if test "$$subdir" = "."; then \
-           dot_seen=yes; \
-           local_target="$$target-am"; \
-         else \
-           local_target="$$target"; \
-         fi; \
-         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-         || eval $$failcom; \
-       done; \
-       if test "$$dot_seen" = "no"; then \
-         $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
-       fi; test -z "$$fail"
-
-mostlyclean-recursive clean-recursive distclean-recursive \
-maintainer-clean-recursive:
-       @failcom='exit 1'; \
-       for f in x $$MAKEFLAGS; do \
-         case $$f in \
-           *=* | --[!k]*);; \
-           *k*) failcom='fail=yes';; \
-         esac; \
-       done; \
-       dot_seen=no; \
-       case "$@" in \
-         distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
-         *) list='$(SUBDIRS)' ;; \
-       esac; \
-       rev=''; for subdir in $$list; do \
-         if test "$$subdir" = "."; then :; else \
-           rev="$$subdir $$rev"; \
-         fi; \
-       done; \
-       rev="$$rev ."; \
-       target=`echo $@ | sed s/-recursive//`; \
-       for subdir in $$rev; do \
-         echo "Making $$target in $$subdir"; \
-         if test "$$subdir" = "."; then \
-           local_target="$$target-am"; \
-         else \
-           local_target="$$target"; \
-         fi; \
-         (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
-         || eval $$failcom; \
-       done && test -z "$$fail"
-tags-recursive:
-       list='$(SUBDIRS)'; for subdir in $$list; do \
-         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
-       done
-ctags-recursive:
-       list='$(SUBDIRS)'; for subdir in $$list; do \
-         test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
-       done
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
-       list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
-       unique=`for i in $$list; do \
-           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-         done | \
-         $(AWK) '    { files[$$0] = 1; } \
-              END { for (i in files) print i; }'`; \
-       mkid -fID $$unique
-tags: TAGS
-
-TAGS: tags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-               $(TAGS_FILES) $(LISP)
-       tags=; \
-       here=`pwd`; \
-       if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
-         include_option=--etags-include; \
-         empty_fix=.; \
-       else \
-         include_option=--include; \
-         empty_fix=; \
-       fi; \
-       list='$(SUBDIRS)'; for subdir in $$list; do \
-         if test "$$subdir" = .; then :; else \
-           test ! -f $$subdir/TAGS || \
-             tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
-         fi; \
-       done; \
-       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-       unique=`for i in $$list; do \
-           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-         done | \
-         $(AWK) '    { files[$$0] = 1; } \
-              END { for (i in files) print i; }'`; \
-       if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
-         test -n "$$unique" || unique=$$empty_fix; \
-         $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
-           $$tags $$unique; \
-       fi
-ctags: CTAGS
-CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.h.in $(TAGS_DEPENDENCIES) \
-               $(TAGS_FILES) $(LISP)
-       tags=; \
-       here=`pwd`; \
-       list='$(SOURCES) $(HEADERS) config.h.in $(LISP) $(TAGS_FILES)'; \
-       unique=`for i in $$list; do \
-           if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
-         done | \
-         $(AWK) '    { files[$$0] = 1; } \
-              END { for (i in files) print i; }'`; \
-       test -z "$(CTAGS_ARGS)$$tags$$unique" \
-         || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
-            $$tags $$unique
-
-GTAGS:
-       here=`$(am__cd) $(top_builddir) && pwd` \
-         && cd $(top_srcdir) \
-         && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
-       -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
-       $(am__remove_distdir)
-       mkdir $(distdir)
-       $(mkdir_p) $(distdir)/os_darwin $(distdir)/os_win32
-       @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
-       topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
-       list='$(DISTFILES)'; for file in $$list; do \
-         case $$file in \
-           $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
-           $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
-         esac; \
-         if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
-         dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
-         if test "$$dir" != "$$file" && test "$$dir" != "."; then \
-           dir="/$$dir"; \
-           $(mkdir_p) "$(distdir)$$dir"; \
-         else \
-           dir=''; \
-         fi; \
-         if test -d $$d/$$file; then \
-           if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
-             cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
-           fi; \
-           cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
-         else \
-           test -f $(distdir)/$$file \
-           || cp -p $$d/$$file $(distdir)/$$file \
-           || exit 1; \
-         fi; \
-       done
-       list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
-         if test "$$subdir" = .; then :; else \
-           test -d "$(distdir)/$$subdir" \
-           || $(mkdir_p) "$(distdir)/$$subdir" \
-           || exit 1; \
-           distdir=`$(am__cd) $(distdir) && pwd`; \
-           top_distdir=`$(am__cd) $(top_distdir) && pwd`; \
-           (cd $$subdir && \
-             $(MAKE) $(AM_MAKEFLAGS) \
-               top_distdir="$$top_distdir" \
-               distdir="$$distdir/$$subdir" \
-               distdir) \
-             || exit 1; \
-         fi; \
-       done
-       -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
-         ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
-         ! -type d ! -perm -400 -exec chmod a+r {} \; -o \
-         ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
-       || chmod -R a+r $(distdir)
-dist-gzip: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-       $(am__remove_distdir)
-
-dist-bzip2: distdir
-       tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2
-       $(am__remove_distdir)
-
-dist-tarZ: distdir
-       tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
-       $(am__remove_distdir)
-
-dist-shar: distdir
-       shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
-       $(am__remove_distdir)
-
-dist-zip: distdir
-       -rm -f $(distdir).zip
-       zip -rq $(distdir).zip $(distdir)
-       $(am__remove_distdir)
-
-dist dist-all: distdir
-       tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
-       $(am__remove_distdir)
-
-# This target untars the dist file and tries a VPATH configuration.  Then
-# it guarantees that the distribution is self-contained by making another
-# tarfile.
-distcheck: dist
-       case '$(DIST_ARCHIVES)' in \
-       *.tar.gz*) \
-         GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(am__untar) ;;\
-       *.tar.bz2*) \
-         bunzip2 -c $(distdir).tar.bz2 | $(am__untar) ;;\
-       *.tar.Z*) \
-         uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
-       *.shar.gz*) \
-         GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
-       *.zip*) \
-         unzip $(distdir).zip ;;\
-       esac
-       chmod -R a-w $(distdir); chmod a+w $(distdir)
-       mkdir $(distdir)/_build
-       mkdir $(distdir)/_inst
-       chmod a-w $(distdir)
-       dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
-         && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
-         && cd $(distdir)/_build \
-         && ../configure --srcdir=.. --prefix="$$dc_install_base" \
-           $(DISTCHECK_CONFIGURE_FLAGS) \
-         && $(MAKE) $(AM_MAKEFLAGS) \
-         && $(MAKE) $(AM_MAKEFLAGS) dvi \
-         && $(MAKE) $(AM_MAKEFLAGS) check \
-         && $(MAKE) $(AM_MAKEFLAGS) install \
-         && $(MAKE) $(AM_MAKEFLAGS) installcheck \
-         && $(MAKE) $(AM_MAKEFLAGS) uninstall \
-         && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
-               distuninstallcheck \
-         && chmod -R a-w "$$dc_install_base" \
-         && ({ \
-              (cd ../.. && umask 077 && mkdir "$$dc_destdir") \
-              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
-              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
-              && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
-                   distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
-             } || { rm -rf "$$dc_destdir"; exit 1; }) \
-         && rm -rf "$$dc_destdir" \
-         && $(MAKE) $(AM_MAKEFLAGS) dist \
-         && rm -rf $(DIST_ARCHIVES) \
-         && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
-       $(am__remove_distdir)
-       @(echo "$(distdir) archives ready for distribution: "; \
-         list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
-         sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
-distuninstallcheck:
-       @cd $(distuninstallcheck_dir) \
-       && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
-          || { echo "ERROR: files left after uninstall:" ; \
-               if test -n "$(DESTDIR)"; then \
-                 echo "  (check DESTDIR support)"; \
-               fi ; \
-               $(distuninstallcheck_listfiles) ; \
-               exit 1; } >&2
-distcleancheck: distclean
-       @if test '$(srcdir)' = . ; then \
-         echo "ERROR: distcleancheck can only run from a VPATH build" ; \
-         exit 1 ; \
-       fi
-       @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
-         || { echo "ERROR: files left in build directory after distclean:" ; \
-              $(distcleancheck_listfiles) ; \
-              exit 1; } >&2
-check-am: all-am
-check: check-recursive
-all-am: Makefile $(PROGRAMS) $(MANS) $(DATA) config.h
-installdirs: installdirs-recursive
-installdirs-am:
-       for dir in "$(DESTDIR)$(sbindir)" "$(DESTDIR)$(man5dir)" "$(DESTDIR)$(man8dir)" "$(DESTDIR)$(docsdir)" "$(DESTDIR)$(initddir)" "$(DESTDIR)$(sysconfdir)"; do \
-         test -z "$$dir" || $(mkdir_p) "$$dir"; \
-       done
-install: install-recursive
-install-exec: install-exec-recursive
-install-data: install-data-recursive
-uninstall: uninstall-recursive
-
-install-am: all-am
-       @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-recursive
-install-strip:
-       $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
-         install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
-         `test -z '$(STRIP)' || \
-           echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
-       -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
-       -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
-       @echo "This command is intended for maintainers to use"
-       @echo "it deletes files that may require special tools to rebuild."
-clean: clean-recursive
-
-clean-am: clean-generic clean-sbinPROGRAMS mostlyclean-am
-
-distclean: distclean-recursive
-       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
-       distclean-hdr distclean-tags
-
-dvi: dvi-recursive
-
-dvi-am:
-
-html: html-recursive
-
-info: info-recursive
-
-info-am:
-
-install-data-am: install-docsDATA install-initdDATA install-man
-
-install-exec-am: install-sbinPROGRAMS install-sysconfDATA
-
-install-info: install-info-recursive
-
-@OS_SOLARIS_FALSE@install-man: install-man5 install-man8
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-recursive
-       -rm -f $(am__CONFIG_DISTCLEAN_FILES)
-       -rm -rf $(top_srcdir)/autom4te.cache
-       -rm -rf ./$(DEPDIR)
-       -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-recursive
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic
-
-pdf: pdf-recursive
-
-pdf-am:
-
-ps: ps-recursive
-
-ps-am:
-
-uninstall-am: uninstall-docsDATA uninstall-info-am uninstall-initdDATA \
-       uninstall-man uninstall-sbinPROGRAMS uninstall-sysconfDATA
-
-uninstall-info: uninstall-info-recursive
-
-@OS_SOLARIS_FALSE@uninstall-man: uninstall-man5 uninstall-man8
-
-.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
-       check-am clean clean-generic clean-recursive \
-       clean-sbinPROGRAMS ctags ctags-recursive dist dist-all \
-       dist-bzip2 dist-gzip dist-shar dist-tarZ dist-zip distcheck \
-       distclean distclean-compile distclean-generic distclean-hdr \
-       distclean-recursive distclean-tags distcleancheck distdir \
-       distuninstallcheck dvi dvi-am html html-am info info-am \
-       install install-am install-data install-data-am \
-       install-docsDATA install-exec install-exec-am install-info \
-       install-info-am install-initdDATA install-man install-man5 \
-       install-man8 install-sbinPROGRAMS install-strip \
-       install-sysconfDATA installcheck installcheck-am installdirs \
-       installdirs-am maintainer-clean maintainer-clean-generic \
-       maintainer-clean-recursive mostlyclean mostlyclean-compile \
-       mostlyclean-generic mostlyclean-recursive pdf pdf-am ps ps-am \
-       tags tags-recursive uninstall uninstall-am uninstall-docsDATA \
-       uninstall-info-am uninstall-initdDATA uninstall-man \
-       uninstall-man5 uninstall-man8 uninstall-sbinPROGRAMS \
-       uninstall-sysconfDATA
-
-
-@SET_MAKE@
-@OS_SOLARIS_TRUE@install-man: $(extra_MANS)
-@OS_SOLARIS_TRUE@      @$(NORMAL_INSTALL)
-@OS_SOLARIS_TRUE@      $(mkinstalldirs) $(DESTDIR)$(mandir)/man4
-@OS_SOLARIS_TRUE@      $(mkinstalldirs) $(DESTDIR)$(mandir)/man1m
-@OS_SOLARIS_TRUE@      for i in $(extra_MANS); do \
-@OS_SOLARIS_TRUE@        if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
-@OS_SOLARIS_TRUE@        else file=$$i; fi; \
-@OS_SOLARIS_TRUE@        ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-@OS_SOLARIS_TRUE@        inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-@OS_SOLARIS_TRUE@        inst=`echo $$inst | sed -e 's/^.*\///'`; \
-@OS_SOLARIS_TRUE@        inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-@OS_SOLARIS_TRUE@        echo " $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
-@OS_SOLARIS_TRUE@        $(INSTALL_DATA) $$file $(DESTDIR)$(mandir)/man$$ext/$$inst; \
-@OS_SOLARIS_TRUE@      done
-@OS_SOLARIS_TRUE@uninstall-man:
-@OS_SOLARIS_TRUE@      @$(NORMAL_UNINSTALL)
-@OS_SOLARIS_TRUE@      for i in $(extra_MANS); do \
-@OS_SOLARIS_TRUE@        if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \
-@OS_SOLARIS_TRUE@        else file=$$i; fi; \
-@OS_SOLARIS_TRUE@        ext=`echo $$i | sed -e 's/^.*\\.//'`; \
-@OS_SOLARIS_TRUE@        inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \
-@OS_SOLARIS_TRUE@        inst=`echo $$inst | sed -e 's/^.*\///'`; \
-@OS_SOLARIS_TRUE@        inst=`echo $$inst | sed '$(transform)'`.$$ext; \
-@OS_SOLARIS_TRUE@        echo " rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst"; \
-@OS_SOLARIS_TRUE@        rm -f $(DESTDIR)$(mandir)/man$$ext/$$inst; \
-@OS_SOLARIS_TRUE@      done
-@OS_SOLARIS_TRUE@%.1m: %.8
-@OS_SOLARIS_TRUE@      awk '/^.TH/ {$$3="1m"} {print}' < $< | \
-@OS_SOLARIS_TRUE@      sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
-@OS_SOLARIS_TRUE@            -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
-@OS_SOLARIS_TRUE@          -e 's/smartctl\(.*\)(8)/smartctl\1(1m)/g' \
-@OS_SOLARIS_TRUE@          -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
-@OS_SOLARIS_TRUE@            -e 's|/var/log/messages|/var/adm/messages|g' \
-@OS_SOLARIS_TRUE@          -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
-@OS_SOLARIS_TRUE@%.4: %.5
-@OS_SOLARIS_TRUE@      awk '/^.TH/ {$$3="4"}  {print}' < $< | \
-@OS_SOLARIS_TRUE@      sed -e 's/smartd\.conf\(.*\)(5)/smartd.conf\1(4)/g' \
-@OS_SOLARIS_TRUE@            -e 's/syslog\.conf\(.*\)(5)/syslog.conf\1(4)/g' \
-@OS_SOLARIS_TRUE@          -e 's/smartctl\(.*\)(8)/smartdctl\1(1m)/g' \
-@OS_SOLARIS_TRUE@          -e 's/syslogd\(.*\)(8)/syslogd\1(1m)/g' \
-@OS_SOLARIS_TRUE@            -e 's|/var/log/messages|/var/adm/messages|g' \
-@OS_SOLARIS_TRUE@          -e 's/smartd\(.*\)(8)/smartd\1(1m)/g' > $@
-
-@SMARTD_SUFFIX_TRUE@smartd.conf$(smartd_suffix): smartd.conf
-@SMARTD_SUFFIX_TRUE@   cp ${srcdir}/smartd.conf smartd.conf$(smartd_suffix)
-
-smartd.conf.5.in: smartd.8.in
-       sed '1,/STARTINCLUDE/ D;/ENDINCLUDE/,$$D' < $(srcdir)/smartd.8.in > $(top_builddir)/tmp.directives
-       sed '/STARTINCLUDE/,$$D'  < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.head
-       sed '1,/ENDINCLUDE/D'   < $(srcdir)/smartd.conf.5.in > $(top_builddir)/tmp.tail
-       cat $(top_builddir)/tmp.head > $(srcdir)/smartd.conf.5.in
-       echo '.\" STARTINCLUDE' >> $(srcdir)/smartd.conf.5.in
-       cat $(top_builddir)/tmp.directives >> $(srcdir)/smartd.conf.5.in
-       echo '.\" ENDINCLUDE'   >> $(srcdir)/smartd.conf.5.in
-       cat $(top_builddir)/tmp.tail >> $(srcdir)/smartd.conf.5.in
-       rm -f $(top_builddir)/tmp.head $(top_builddir)/tmp.tail $(top_builddir)/tmp.directives
-
-@OS_DARWIN_TRUE@SMART : os_darwin/SMART.in
-@OS_DARWIN_TRUE@       sed "s|/usr/sbin/|$(sbindir)/|" $< > $@
-
-@OS_DARWIN_TRUE@install-initdDATA-darwin: $(initd_DATA)
-@OS_DARWIN_TRUE@       $(mkinstalldirs) $(DESTDIR)$(initddir)
-@OS_DARWIN_TRUE@       $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART
-@OS_DARWIN_TRUE@       $(mkinstalldirs) $(DESTDIR)$(initddir)/SMART/Resources
-@OS_DARWIN_TRUE@       $(INSTALL_SCRIPT) $(top_builddir)/SMART $(DESTDIR)$(initddir)/SMART
-@OS_DARWIN_TRUE@       $(INSTALL_DATA) $(srcdir)/os_darwin/StartupParameters.plist \
-@OS_DARWIN_TRUE@           $(DESTDIR)$(initddir)/SMART/StartupParameters.plist
-@OS_DARWIN_TRUE@       for i in English ; do \
-@OS_DARWIN_TRUE@         RDIR=$(DESTDIR)$(initddir)/SMART/Resources/$${i}.lproj ; \
-@OS_DARWIN_TRUE@         $(mkinstalldirs) $$RDIR ;\
-@OS_DARWIN_TRUE@         $(INSTALL_DATA) $(srcdir)/os_darwin/$${i}_Localizable.strings \
-@OS_DARWIN_TRUE@           $$RDIR/Localizable.strings ; \
-@OS_DARWIN_TRUE@       done
-@OS_DARWIN_TRUE@       @echo -e "\n\n####################################################################\n#"
-@OS_DARWIN_TRUE@       @echo -e "#                       PLEASE READ THIS BOX!\n#"
-@OS_DARWIN_TRUE@       @echo -e "#   To manually start the smartd daemon, run:\n#   ${initddir}/SMART/SMART start\n#"
-@OS_DARWIN_TRUE@       @echo -e "#   To automatically start smartd on bootup, add the line:\n#   SMARTd=-YES-\n#   to /etc/hostconfig\n#"
-@OS_DARWIN_TRUE@       @echo -e "#   smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n#   man smartd"
-@OS_DARWIN_TRUE@       @echo -e "#   to learn about it. A sample configuration file can be found in:\n#   ${docdir}\n#"
-@OS_DARWIN_TRUE@       @echo -e "####################################################################\n\n"
-
-@OS_DARWIN_FALSE@smartd.initd: $(srcdir)/smartd.initd.in Makefile
-@OS_DARWIN_FALSE@      sed "s|/usr/local/sbin/|$(sbindir)/|g" $(srcdir)/smartd.initd.in > $@
-
-@OS_DARWIN_FALSE@install-initdDATA-generic: $(initd_DATA)
-@OS_DARWIN_FALSE@      $(mkinstalldirs) $(DESTDIR)$(initddir)
-@OS_DARWIN_FALSE@      $(INSTALL_SCRIPT) $(top_builddir)/smartd.initd $(DESTDIR)$(initddir)/smartd$(smartd_suffix)
-@OS_DARWIN_FALSE@      @echo -e "\n\n####################################################################\n#"
-@OS_DARWIN_FALSE@      @echo -e "#                       PLEASE READ THIS BOX!\n#"
-@OS_DARWIN_FALSE@      @echo -e "#   To manually start the smartd daemon, run:\n#   ${initddir}/smartd start\n#"
-@OS_DARWIN_FALSE@      @echo -e "#   To automatically start smartd on bootup, run:\n#   /sbin/chkconfig --add smartd\n#"
-@OS_DARWIN_FALSE@      @echo -e "#   smartd can now use a configuration file ${sysconfdir}/smartd.conf. Do:\n#   man smartd"
-@OS_DARWIN_FALSE@      @echo -e "#   to learn about it. A sample configuration file can be found in:\n#   ${docdir}\n#"
-@OS_DARWIN_FALSE@      @echo -e "####################################################################\n\n"
-
-install-initdDATA : $(initd_DATA_install)
-
-uninstall-initdDATA:
-       rm -rf $(DESTDIR)$(initddir)/$(initd_install_name)
-
-uninstall-docsDATA:
-       rm -rf $(DESTDIR)$(docsdir)
-
-smart%: $(srcdir)/smart%.in Makefile
-       sed "s|CURRENT_CVS_VERSION|$(releaseversion)|g" $< | \
-       sed "s|CURRENT_CVS_DATE|$(smartmontools_release_date)|g" | \
-       sed "s|CURRENT_CVS_TIME|$(smartmontools_release_time)|g" | \
-       sed "s|/usr/local/share/man/|$(mandir)/|g" | \
-       sed "s|/usr/local/sbin/|$(sbindir)/|g" | \
-       sed "s|/usr/local/etc/rc\\.d/init.d/|$(initddir)/|g" | \
-       sed "s|/usr/local/share/doc/smartmontools-5.1/|$(docsdir)/|g" | \
-       sed "s|/usr/local/etc/smartd\\.conf|$(sysconfdir)/smartd.conf|g" > $@
-
-# Convert man pages into .html and .txt
-
-htmlman: smartctl.8.html smartd.8.html smartd.conf.5.html
-
-txtman:  smartctl.8.txt smartd.8.txt smartd.conf.5.txt
-
-@OS_WIN32_MINGW_TRUE@%.5.html: %.5
-@OS_WIN32_MINGW_TRUE@  $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
-
-@OS_WIN32_MINGW_TRUE@%.8.html: %.8
-@OS_WIN32_MINGW_TRUE@  $(DOS2UNIX) < $< | $(MAN2HTML) | $(FIXHTML) > $@
-
-@OS_WIN32_MINGW_FALSE@%.5.html: %.5
-@OS_WIN32_MINGW_FALSE@ $(MAN2HTML) $< | $(FIXHTML) > $@
-
-@OS_WIN32_MINGW_FALSE@%.8.html: %.8
-@OS_WIN32_MINGW_FALSE@ $(MAN2HTML) $< | $(FIXHTML) > $@
-
-%.5.txt: %.5
-       $(MAN2TXT) $< > $@
-
-%.8.txt: %.8
-       $(MAN2TXT) $< > $@
-
-# Build Windows distribution
-
-@OS_WIN32_MINGW_TRUE@dist-win32: $(distzip_win32)
-
-@OS_WIN32_MINGW_TRUE@install-win32: $(distinst_win32)
-@OS_WIN32_MINGW_TRUE@  ./$(distinst_win32)
-
-@OS_WIN32_MINGW_TRUE@installer-win32: $(distinst_win32)
-
-@OS_WIN32_MINGW_TRUE@distdir-win32: distdir.mkdir $(FILES_WIN32) syslogevt.check
-
-@OS_WIN32_MINGW_TRUE@$(distzip_win32): distdir.mkdir $(FILES_WIN32) syslogevt.check
-@OS_WIN32_MINGW_TRUE@  @rm -fv $(distzip_win32)
-@OS_WIN32_MINGW_TRUE@  cd $(distdir_win32) && zip -9Dr ../$(distzip_win32) .
-
-# Build NSIS installer, try to locate makensis in default location first
-@OS_WIN32_MINGW_TRUE@$(distinst_win32): $(srcdir)/os_win32/installer.nsi distdir.mkdir $(FILES_WIN32) syslogevt.check
-@OS_WIN32_MINGW_TRUE@  @makensis="$(MAKENSIS)"; if [ -z "$$makensis" ]; then \
-@OS_WIN32_MINGW_TRUE@    if [ ! -z "$$PROGRAMFILES" ] && "$$PROGRAMFILES/NSIS/makensis" /VERSION >/dev/null 2>&1; then \
-@OS_WIN32_MINGW_TRUE@      makensis="$$PROGRAMFILES/NSIS/makensis"; \
-@OS_WIN32_MINGW_TRUE@    elif makensis /VERSION >/dev/null 2>&1; then \
-@OS_WIN32_MINGW_TRUE@      makensis=makensis; \
-@OS_WIN32_MINGW_TRUE@    else \
-@OS_WIN32_MINGW_TRUE@      echo 'makensis: command not found. Please download and install NSIS' 1>&2; \
-@OS_WIN32_MINGW_TRUE@      echo 'from http://nsis.sourceforge.net/Download' 1>&2; exit 1; \
-@OS_WIN32_MINGW_TRUE@    fi; \
-@OS_WIN32_MINGW_TRUE@  fi; \
-@OS_WIN32_MINGW_TRUE@  echo "$$makensis /V2 /NOCD /DINPDIR=$(distdir_win32) /DOUTFILE=$(distinst_win32) $(srcdir)/os_win32/installer.nsi"; \
-@OS_WIN32_MINGW_TRUE@  "$$makensis" /V2 /NOCD /DINPDIR="$(distdir_win32)" /DOUTFILE="$(distinst_win32)" "$(srcdir)/os_win32/installer.nsi"
-
-@OS_WIN32_MINGW_TRUE@cleandist-win32:
-@OS_WIN32_MINGW_TRUE@  rm -rf $(distdir_win32) distdir.mkdir syslogevt.check
-
-@OS_WIN32_MINGW_TRUE@distdir.mkdir:
-@OS_WIN32_MINGW_TRUE@  @test -d $(exedir_win32) || mkdir -pv $(exedir_win32)
-@OS_WIN32_MINGW_TRUE@  @test -d $(docdir_win32) || mkdir -pv $(docdir_win32)
-@OS_WIN32_MINGW_TRUE@  touch $@
-
-@OS_WIN32_MINGW_TRUE@syslogevt.check:
-@OS_WIN32_MINGW_TRUE@  @if [ -f $(srcdir)/os_win32/syslogevt.exe ]; then \
-@OS_WIN32_MINGW_TRUE@    cp -pv $(srcdir)/os_win32/syslogevt.exe $(exedir_win32)/syslogevt.exe; \
-@OS_WIN32_MINGW_TRUE@   else echo "Warning: $(srcdir)/os_win32/syslogevt.exe missing."; fi
-@OS_WIN32_MINGW_TRUE@  touch $@
-
-@OS_WIN32_MINGW_TRUE@$(exedir_win32)/%.exe: %.exe
-@OS_WIN32_MINGW_TRUE@  cp -p $< $@
-@OS_WIN32_MINGW_TRUE@  strip -s $@
-@OS_WIN32_MINGW_TRUE@  touch -r $< $@
-
-@OS_WIN32_MINGW_TRUE@$(docdir_win32)/%.html: %.html
-@OS_WIN32_MINGW_TRUE@  $(UNIX2DOS) < $< > $@
-@OS_WIN32_MINGW_TRUE@  touch -r $< $@
-
-@OS_WIN32_MINGW_TRUE@$(docdir_win32)/%.txt: %.txt
-@OS_WIN32_MINGW_TRUE@  $(UNIX2DOS) < $< > $@
-@OS_WIN32_MINGW_TRUE@  touch -r $< $@
-
-@OS_WIN32_MINGW_TRUE@$(docdir_win32)/%.txt: $(srcdir)/%
-@OS_WIN32_MINGW_TRUE@  $(UNIX2DOS) < $< > $@
-@OS_WIN32_MINGW_TRUE@  touch -r $< $@
-
-@OS_WIN32_MINGW_TRUE@$(docdir_win32)/%.conf: $(srcdir)/%.conf
-@OS_WIN32_MINGW_TRUE@  $(UNIX2DOS) < $< > $@
-@OS_WIN32_MINGW_TRUE@  touch -r $< $@
-
-# Build config_vc6.h for MSVC 6 from MinGW config.h
-
-@OS_WIN32_MINGW_TRUE@config-vc6: $(srcdir)/os_win32/config_vc6.h
-
-@OS_WIN32_MINGW_TRUE@$(srcdir)/os_win32/config_vc6.h: config.h
-@OS_WIN32_MINGW_TRUE@  sed '1i/* config_vc6.h.  Generated by Makefile.  */' $< | \
-@OS_WIN32_MINGW_TRUE@  sed 's,^#define HAVE_\(ATTR_PACKED\|INTTYPES_H\|STDINT_H\|STRINGS_H\|STRTOULL\|U*INT64_T\|UNISTD_H\) 1$$,/* #undef HAVE_\1 */,' | \
-@OS_WIN32_MINGW_TRUE@  sed 's,i.86-pc-mingw32,i686-pc-win32vc6,' > $@
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/TODO b/TODO
index 3f7b2e82724f463fa2dee2a90ebb0f405214d916..22d814bbcf33a7691debe9635ed3a919e02a3ee6 100644 (file)
--- a/TODO
+++ b/TODO
@@ -1,6 +1,6 @@
 TODO list for smartmontools:
 
-$Id: TODO,v 1.62 2006/10/27 21:49:42 chrfranke Exp $
+$Id: TODO,v 1.64 2007/09/03 19:36:58 chrfranke Exp $
 
 SATA devices under Linux
 ------------------------
@@ -30,21 +30,6 @@ Since this looks like this patch will become standard, we need to add something
 to smartmontools to automatically recognize the libata, and add the '-d ata'
 automatically.
 
-SATA devices
-------------
-The ATA PASS THROUGH SCSI command (12 and 16 byte cdb) as defined in
-SAT: http://www.t10.org/ftp/t10/drafts/sat/sat-r07.pdf (section 12.2)
-provides a general way to pass ATA SMART commands through to SATA
-devices.
-
-Doug Gilbert will in the future add a '-d sat' type (note, this is not
-a typo, we do not mean '-d sata') which will instruct the generic
-smartmontools code to assume an ATA device but use those ATA PASS
-THROUGH commands.
-
-This should provide additional support for SATA devices under most or
-all operating systems.
-
 USB devices under Linux
 -----------------------
 Some USB devices can hang smartctl or smartd.  This is because these
@@ -106,11 +91,6 @@ executable/script in the background rather than in the foreground.
 But let's wait for someone to request this. At that point we should
 probably use fork/exec rather than system().
 
-Perhaps change smartd to look in /proc/ide and /proc/scsi to see what
-exists? If something doesn't exit then don't try to open it?  This
-should probably be the default option if there is no configuration
-file.
-
 Add ability to monitor "worst" value from attributes (sometimes it
 gets larger!) and to monitor the threshold value (sometimes it
 changes!).
@@ -119,15 +99,6 @@ Add command line option that scans devices then WRITES
 /etc/smartd.conf, perhaps as /etc/smartd.conf.output, just for devices
 that can be monitored.
 
-FreeBSD
--------
-
-Add support for 3ware 9000 series SATA controllers.
-
-Cygwin and Windows
-------------------
-Support DEVICESCAN for SPT (IOCTL_SCSI_PASS_THROUGH).
-
 Packaging
 ---------
 Under freebsd and solaris, the following are wrong:
diff --git a/aclocal.m4 b/aclocal.m4
deleted file mode 100644 (file)
index d57c035..0000000
+++ /dev/null
@@ -1,912 +0,0 @@
-# generated automatically by aclocal 1.9.6 -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005  Free Software Foundation, Inc.
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-# Copyright (C) 2002, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_AUTOMAKE_VERSION(VERSION)
-# ----------------------------
-# Automake X.Y traces this macro to ensure aclocal.m4 has been
-# generated from the m4 files accompanying Automake X.Y.
-AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.9"])
-
-# AM_SET_CURRENT_AUTOMAKE_VERSION
-# -------------------------------
-# Call AM_AUTOMAKE_VERSION so it can be traced.
-# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
-AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-        [AM_AUTOMAKE_VERSION([1.9.6])])
-
-# Figure out how to run the assembler.                      -*- Autoconf -*-
-
-# Copyright (C) 2001, 2003, 2004, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-# AM_PROG_AS
-# ----------
-AC_DEFUN([AM_PROG_AS],
-[# By default we simply use the C compiler to build assembly code.
-AC_REQUIRE([AC_PROG_CC])
-test "${CCAS+set}" = set || CCAS=$CC
-test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
-AC_ARG_VAR([CCAS],      [assembler compiler command (defaults to CC)])
-AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)])
-])
-
-# AM_AUX_DIR_EXPAND                                         -*- Autoconf -*-
-
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
-# $ac_aux_dir to `$srcdir/foo'.  In other projects, it is set to
-# `$srcdir', `$srcdir/..', or `$srcdir/../..'.
-#
-# Of course, Automake must honor this variable whenever it calls a
-# tool from the auxiliary directory.  The problem is that $srcdir (and
-# therefore $ac_aux_dir as well) can be either absolute or relative,
-# depending on how configure is run.  This is pretty annoying, since
-# it makes $ac_aux_dir quite unusable in subdirectories: in the top
-# source directory, any form will work fine, but in subdirectories a
-# relative path needs to be adjusted first.
-#
-# $ac_aux_dir/missing
-#    fails when called from a subdirectory if $ac_aux_dir is relative
-# $top_srcdir/$ac_aux_dir/missing
-#    fails if $ac_aux_dir is absolute,
-#    fails when called from a subdirectory in a VPATH build with
-#          a relative $ac_aux_dir
-#
-# The reason of the latter failure is that $top_srcdir and $ac_aux_dir
-# are both prefixed by $srcdir.  In an in-source build this is usually
-# harmless because $srcdir is `.', but things will broke when you
-# start a VPATH build or use an absolute $srcdir.
-#
-# So we could use something similar to $top_srcdir/$ac_aux_dir/missing,
-# iff we strip the leading $srcdir from $ac_aux_dir.  That would be:
-#   am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"`
-# and then we would define $MISSING as
-#   MISSING="\${SHELL} $am_aux_dir/missing"
-# This will work as long as MISSING is not called from configure, because
-# unfortunately $(top_srcdir) has no meaning in configure.
-# However there are other variables, like CC, which are often used in
-# configure, and could therefore not use this "fixed" $ac_aux_dir.
-#
-# Another solution, used here, is to always expand $ac_aux_dir to an
-# absolute PATH.  The drawback is that using absolute paths prevent a
-# configured tree to be moved without reconfiguration.
-
-AC_DEFUN([AM_AUX_DIR_EXPAND],
-[dnl Rely on autoconf to set up CDPATH properly.
-AC_PREREQ([2.50])dnl
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-])
-
-# AM_CONDITIONAL                                            -*- Autoconf -*-
-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 7
-
-# AM_CONDITIONAL(NAME, SHELL-CONDITION)
-# -------------------------------------
-# Define a conditional.
-AC_DEFUN([AM_CONDITIONAL],
-[AC_PREREQ(2.52)dnl
- ifelse([$1], [TRUE],  [AC_FATAL([$0: invalid condition: $1])],
-       [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
-AC_SUBST([$1_TRUE])
-AC_SUBST([$1_FALSE])
-if $2; then
-  $1_TRUE=
-  $1_FALSE='#'
-else
-  $1_TRUE='#'
-  $1_FALSE=
-fi
-AC_CONFIG_COMMANDS_PRE(
-[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
-  AC_MSG_ERROR([[conditional "$1" was never defined.
-Usually this means the macro was only invoked conditionally.]])
-fi])])
-
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 8
-
-# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be
-# written in clear, in which case automake, when reading aclocal.m4,
-# will think it sees a *use*, and therefore will trigger all it's
-# C support machinery.  Also note that it means that autoscan, seeing
-# CC etc. in the Makefile, will ask for an AC_PROG_CC use...
-
-
-# _AM_DEPENDENCIES(NAME)
-# ----------------------
-# See how the compiler implements dependency checking.
-# NAME is "CC", "CXX", "GCJ", or "OBJC".
-# We try a few techniques and use that to set a single cache variable.
-#
-# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was
-# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular
-# dependency, and given that the user is not expected to run this macro,
-# just rely on AC_PROG_CC.
-AC_DEFUN([_AM_DEPENDENCIES],
-[AC_REQUIRE([AM_SET_DEPDIR])dnl
-AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl
-AC_REQUIRE([AM_MAKE_INCLUDE])dnl
-AC_REQUIRE([AM_DEP_TRACK])dnl
-
-ifelse([$1], CC,   [depcc="$CC"   am_compiler_list=],
-       [$1], CXX,  [depcc="$CXX"  am_compiler_list=],
-       [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'],
-       [$1], GCJ,  [depcc="$GCJ"  am_compiler_list='gcc3 gcc'],
-                   [depcc="$$1"   am_compiler_list=])
-
-AC_CACHE_CHECK([dependency style of $depcc],
-               [am_cv_$1_dependencies_compiler_type],
-[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_$1_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp`
-  fi
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    case $depmode in
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-       continue
-      else
-       break
-      fi
-      ;;
-    none) break ;;
-    esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
-    if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_$1_dependencies_compiler_type=$depmode
-        break
-      fi
-    fi
-  done
-
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_$1_dependencies_compiler_type=none
-fi
-])
-AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type])
-AM_CONDITIONAL([am__fastdep$1], [
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_$1_dependencies_compiler_type" = gcc3])
-])
-
-
-# AM_SET_DEPDIR
-# -------------
-# Choose a directory name for dependency files.
-# This macro is AC_REQUIREd in _AM_DEPENDENCIES
-AC_DEFUN([AM_SET_DEPDIR],
-[AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl
-])
-
-
-# AM_DEP_TRACK
-# ------------
-AC_DEFUN([AM_DEP_TRACK],
-[AC_ARG_ENABLE(dependency-tracking,
-[  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors])
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-fi
-AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno])
-AC_SUBST([AMDEPBACKSLASH])
-])
-
-# Generate code to set up dependency tracking.              -*- Autoconf -*-
-
-# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-#serial 3
-
-# _AM_OUTPUT_DEPENDENCY_COMMANDS
-# ------------------------------
-AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS],
-[for mf in $CONFIG_FILES; do
-  # Strip MF so we end up with the name of the file.
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  # Check whether this is an Automake generated Makefile or not.
-  # We used to match only the files named `Makefile.in', but
-  # some people rename them; so instead we look at the file content.
-  # Grep'ing the first line is not enough: some people post-process
-  # each Makefile.in and add a new line on top of each file to say so.
-  # So let's grep whole file.
-  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
-    dirpart=`AS_DIRNAME("$mf")`
-  else
-    continue
-  fi
-  # Extract the definition of DEPDIR, am__include, and am__quote
-  # from the Makefile without running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-  test -z "$DEPDIR" && continue
-  am__include=`sed -n 's/^am__include = //p' < "$mf"`
-  test -z "am__include" && continue
-  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-  # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
-  # Find all dependency output files, they are included files with
-  # $(DEPDIR) in their names.  We invoke sed twice because it is the
-  # simplest approach to changing $(DEPDIR) to its actual value in the
-  # expansion.
-  for file in `sed -n "
-    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-    # Make sure the directory exists.
-    test -f "$dirpart/$file" && continue
-    fdir=`AS_DIRNAME(["$file"])`
-    AS_MKDIR_P([$dirpart/$fdir])
-    # echo "creating $dirpart/$file"
-    echo '# dummy' > "$dirpart/$file"
-  done
-done
-])# _AM_OUTPUT_DEPENDENCY_COMMANDS
-
-
-# AM_OUTPUT_DEPENDENCY_COMMANDS
-# -----------------------------
-# This macro should only be invoked once -- use via AC_REQUIRE.
-#
-# This code is only required when automatic dependency tracking
-# is enabled.  FIXME.  This creates each `.P' file that we will
-# need in order to bootstrap the dependency handling code.
-AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS],
-[AC_CONFIG_COMMANDS([depfiles],
-     [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS],
-     [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"])
-])
-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 8
-
-# AM_CONFIG_HEADER is obsolete.  It has been replaced by AC_CONFIG_HEADERS.
-AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
-
-# Do all the work for Automake.                             -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 12
-
-# This macro actually does too much.  Some checks are only needed if
-# your package does certain things.  But this isn't really a big deal.
-
-# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
-# AM_INIT_AUTOMAKE([OPTIONS])
-# -----------------------------------------------
-# The call with PACKAGE and VERSION arguments is the old style
-# call (pre autoconf-2.50), which is being phased out.  PACKAGE
-# and VERSION should now be passed to AC_INIT and removed from
-# the call to AM_INIT_AUTOMAKE.
-# We support both call styles for the transition.  After
-# the next Automake release, Autoconf can make the AC_INIT
-# arguments mandatory, and then we can depend on a new Autoconf
-# release and drop the old call support.
-AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.58])dnl
-dnl Autoconf wants to disallow AM_ names.  We explicitly allow
-dnl the ones we care about.
-m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
-AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
-AC_REQUIRE([AC_PROG_INSTALL])dnl
-# test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" &&
-   test -f $srcdir/config.status; then
-  AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
-  if (cygpath --version) >/dev/null 2>/dev/null; then
-    CYGPATH_W='cygpath -w'
-  else
-    CYGPATH_W=echo
-  fi
-fi
-AC_SUBST([CYGPATH_W])
-
-# Define the identity of the package.
-dnl Distinguish between old-style and new-style calls.
-m4_ifval([$2],
-[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl
- AC_SUBST([PACKAGE], [$1])dnl
- AC_SUBST([VERSION], [$2])],
-[_AM_SET_OPTIONS([$1])dnl
- AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
- AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
-
-_AM_IF_OPTION([no-define],,
-[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package])
- AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl
-
-# Some tools Automake needs.
-AC_REQUIRE([AM_SANITY_CHECK])dnl
-AC_REQUIRE([AC_ARG_PROGRAM])dnl
-AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version})
-AM_MISSING_PROG(AUTOCONF, autoconf)
-AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
-AM_MISSING_PROG(AUTOHEADER, autoheader)
-AM_MISSING_PROG(MAKEINFO, makeinfo)
-AM_PROG_INSTALL_SH
-AM_PROG_INSTALL_STRIP
-AC_REQUIRE([AM_PROG_MKDIR_P])dnl
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([AC_PROG_MAKE_SET])dnl
-AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
-              [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
-                            [_AM_PROG_TAR([v7])])])
-_AM_IF_OPTION([no-dependencies],,
-[AC_PROVIDE_IFELSE([AC_PROG_CC],
-                  [_AM_DEPENDENCIES(CC)],
-                  [define([AC_PROG_CC],
-                          defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_CXX],
-                  [_AM_DEPENDENCIES(CXX)],
-                  [define([AC_PROG_CXX],
-                          defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
-])
-])
-
-
-# When config.status generates a header, we must update the stamp-h file.
-# This file resides in the same directory as the config header
-# that is generated.  The stamp files are numbered to have different names.
-
-# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the
-# loop where config.status creates the headers, so we can generate
-# our stamp files there.
-AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
-[# Compute $1's index in $config_headers.
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $1 | $1:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
-  esac
-done
-echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
-
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_INSTALL_SH
-# ------------------
-# Define $install_sh.
-AC_DEFUN([AM_PROG_INSTALL_SH],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-install_sh=${install_sh-"$am_aux_dir/install-sh"}
-AC_SUBST(install_sh)])
-
-# Copyright (C) 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# Check whether the underlying file-system supports filenames
-# with a leading dot.  For instance MS-DOS doesn't.
-AC_DEFUN([AM_SET_LEADING_DOT],
-[rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
-  am__leading_dot=.
-else
-  am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-AC_SUBST([am__leading_dot])])
-
-# Add --enable-maintainer-mode option to configure.         -*- Autoconf -*-
-# From Jim Meyering
-
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-AC_DEFUN([AM_MAINTAINER_MODE],
-[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
-  dnl maintainer-mode is disabled by default
-  AC_ARG_ENABLE(maintainer-mode,
-[  --enable-maintainer-mode  enable make rules and dependencies not useful
-                         (and sometimes confusing) to the casual installer],
-      USE_MAINTAINER_MODE=$enableval,
-      USE_MAINTAINER_MODE=no)
-  AC_MSG_RESULT([$USE_MAINTAINER_MODE])
-  AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
-  MAINT=$MAINTAINER_MODE_TRUE
-  AC_SUBST(MAINT)dnl
-]
-)
-
-AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
-
-# Check to see how 'make' treats includes.                 -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 3
-
-# AM_MAKE_INCLUDE()
-# -----------------
-# Check to see how make treats includes.
-AC_DEFUN([AM_MAKE_INCLUDE],
-[am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-       @echo done
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-AC_MSG_CHECKING([for style of include used by $am_make])
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# We grep out `Entering directory' and `Leaving directory'
-# messages which can occur if `w' ends up in MAKEFLAGS.
-# In particular we don't look at `^make:' because GNU make might
-# be invoked under some other name (usually "gmake"), in which
-# case it prints its new name instead of `make'.
-if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
-   am__include=include
-   am__quote=
-   _am_result=GNU
-fi
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
-      am__include=.include
-      am__quote="\""
-      _am_result=BSD
-   fi
-fi
-AC_SUBST([am__include])
-AC_SUBST([am__quote])
-AC_MSG_RESULT([$_am_result])
-rm -f confinc confmf
-])
-
-# Fake the existence of programs that GNU maintainers use.  -*- Autoconf -*-
-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-# AM_MISSING_PROG(NAME, PROGRAM)
-# ------------------------------
-AC_DEFUN([AM_MISSING_PROG],
-[AC_REQUIRE([AM_MISSING_HAS_RUN])
-$1=${$1-"${am_missing_run}$2"}
-AC_SUBST($1)])
-
-
-# AM_MISSING_HAS_RUN
-# ------------------
-# Define MISSING if not defined so far and test if it supports --run.
-# If it does, set am_missing_run to use it, otherwise, to nothing.
-AC_DEFUN([AM_MISSING_HAS_RUN],
-[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
-else
-  am_missing_run=
-  AC_MSG_WARN([`missing' script is too old or missing])
-fi
-])
-
-# Copyright (C) 2003, 2004, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_MKDIR_P
-# ---------------
-# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-#
-# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
-# created by `make install' are always world readable, even if the
-# installer happens to have an overly restrictive umask (e.g. 077).
-# This was a mistake.  There are at least two reasons why we must not
-# use `-m 0755':
-#   - it causes special bits like SGID to be ignored,
-#   - it may be too restrictive (some setups expect 775 directories).
-#
-# Do not use -m 0755 and let people choose whatever they expect by
-# setting umask.
-#
-# We cannot accept any implementation of `mkdir' that recognizes `-p'.
-# Some implementations (such as Solaris 8's) are not thread-safe: if a
-# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
-# concurrently, both version can detect that a/ is missing, but only
-# one can create it and the other will error out.  Consequently we
-# restrict ourselves to GNU make (using the --version option ensures
-# this.)
-AC_DEFUN([AM_PROG_MKDIR_P],
-[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
-  # We used to keeping the `.' as first argument, in order to
-  # allow $(mkdir_p) to be used without argument.  As in
-  #   $(mkdir_p) $(somedir)
-  # where $(somedir) is conditionally defined.  However this is wrong
-  # for two reasons:
-  #  1. if the package is installed by a user who cannot write `.'
-  #     make install will fail,
-  #  2. the above comment should most certainly read
-  #     $(mkdir_p) $(DESTDIR)$(somedir)
-  #     so it does not work when $(somedir) is undefined and
-  #     $(DESTDIR) is not.
-  #  To support the latter case, we have to write
-  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
-  #  so the `.' trick is pointless.
-  mkdir_p='mkdir -p --'
-else
-  # On NextStep and OpenStep, the `mkdir' command does not
-  # recognize any option.  It will interpret all options as
-  # directories to create, and then abort because `.' already
-  # exists.
-  for d in ./-p ./--version;
-  do
-    test -d $d && rmdir $d
-  done
-  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
-  if test -f "$ac_aux_dir/mkinstalldirs"; then
-    mkdir_p='$(mkinstalldirs)'
-  else
-    mkdir_p='$(install_sh) -d'
-  fi
-fi
-AC_SUBST([mkdir_p])])
-
-# Helper functions for option handling.                     -*- Autoconf -*-
-
-# Copyright (C) 2001, 2002, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 3
-
-# _AM_MANGLE_OPTION(NAME)
-# -----------------------
-AC_DEFUN([_AM_MANGLE_OPTION],
-[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
-
-# _AM_SET_OPTION(NAME)
-# ------------------------------
-# Set option NAME.  Presently that only means defining a flag for this option.
-AC_DEFUN([_AM_SET_OPTION],
-[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
-
-# _AM_SET_OPTIONS(OPTIONS)
-# ----------------------------------
-# OPTIONS is a space-separated list of Automake options.
-AC_DEFUN([_AM_SET_OPTIONS],
-[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
-
-# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
-# -------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-AC_DEFUN([_AM_IF_OPTION],
-[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-
-# Check to make sure that the build environment is sane.    -*- Autoconf -*-
-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 4
-
-# AM_SANITY_CHECK
-# ---------------
-AC_DEFUN([AM_SANITY_CHECK],
-[AC_MSG_CHECKING([whether build environment is sane])
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments.  Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
-   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
-   if test "$[*]" = "X"; then
-      # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$[*]" != "X $srcdir/configure conftest.file" \
-      && test "$[*]" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      AC_MSG_ERROR([ls -t appears to fail.  Make sure there is not a broken
-alias in your environment])
-   fi
-
-   test "$[2]" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   AC_MSG_ERROR([newly created file is older than distributed files!
-Check your system clock])
-fi
-AC_MSG_RESULT(yes)])
-
-# Copyright (C) 2001, 2003, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# AM_PROG_INSTALL_STRIP
-# ---------------------
-# One issue with vendor `install' (even GNU) is that you can't
-# specify the program used to strip binaries.  This is especially
-# annoying in cross-compiling environments, where the build's strip
-# is unlikely to handle the host's binaries.
-# Fortunately install-sh will honor a STRIPPROG variable, so we
-# always use install-sh in `make install-strip', and initialize
-# STRIPPROG with the value of the STRIP variable (set by the user).
-AC_DEFUN([AM_PROG_INSTALL_STRIP],
-[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
-if test "$cross_compiling" != no; then
-  AC_CHECK_TOOL([STRIP], [strip], :)
-fi
-INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
-AC_SUBST([INSTALL_STRIP_PROGRAM])])
-
-# Check how to create a tarball.                            -*- Autoconf -*-
-
-# Copyright (C) 2004, 2005  Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# _AM_PROG_TAR(FORMAT)
-# --------------------
-# Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
-#
-# Substitute a variable $(am__tar) that is a command
-# writing to stdout a FORMAT-tarball containing the directory
-# $tardir.
-#     tardir=directory && $(am__tar) > result.tar
-#
-# Substitute a variable $(am__untar) that extract such
-# a tarball read from stdin.
-#     $(am__untar) < result.tar
-AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility.
-AM_MISSING_PROG([AMTAR], [tar])
-m4_if([$1], [v7],
-     [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'],
-     [m4_case([$1], [ustar],, [pax],,
-              [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
-  case $_am_tool in
-  gnutar)
-    for _am_tar in tar gnutar gtar;
-    do
-      AM_RUN_LOG([$_am_tar --version]) && break
-    done
-    am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
-    am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
-    am__untar="$_am_tar -xf -"
-    ;;
-  plaintar)
-    # Must skip GNU tar: if it does not support --format= it doesn't create
-    # ustar tarball either.
-    (tar --version) >/dev/null 2>&1 && continue
-    am__tar='tar chf - "$$tardir"'
-    am__tar_='tar chf - "$tardir"'
-    am__untar='tar xf -'
-    ;;
-  pax)
-    am__tar='pax -L -x $1 -w "$$tardir"'
-    am__tar_='pax -L -x $1 -w "$tardir"'
-    am__untar='pax -r'
-    ;;
-  cpio)
-    am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
-    am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
-    am__untar='cpio -i -H $1 -d'
-    ;;
-  none)
-    am__tar=false
-    am__tar_=false
-    am__untar=false
-    ;;
-  esac
-
-  # If the value was cached, stop now.  We just wanted to have am__tar
-  # and am__untar set.
-  test -n "${am_cv_prog_tar_$1}" && break
-
-  # tar/untar a dummy directory, and stop if the command works
-  rm -rf conftest.dir
-  mkdir conftest.dir
-  echo GrepMe > conftest.dir/file
-  AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
-  rm -rf conftest.dir
-  if test -s conftest.tar; then
-    AM_RUN_LOG([$am__untar <conftest.tar])
-    grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
-  fi
-done
-rm -rf conftest.dir
-
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
-AC_SUBST([am__tar])
-AC_SUBST([am__untar])
-]) # _AM_PROG_TAR
-
index 4cd9de527f34abc0ab572d4d6b991d064ac875b3..77129b6722ed3ac6fe257109b91ed73f5a8993f3 100644 (file)
@@ -3,7 +3,7 @@
  * 
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
  *
@@ -36,7 +36,7 @@
 #include "extern.h"
 #include "utility.h"
 
-const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.177 2006/10/27 21:30:02 chrfranke Exp $"
+const char *atacmds_c_cvsid="$Id: atacmds.cpp,v 1.188 2007/07/26 20:58:50 chrfranke Exp $"
 ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSIATA_H_CVSID UTILITY_H_CVSID;
 
 // to hold onto exit code for atexit routine
@@ -514,6 +514,25 @@ void swap8(char *location){
   return;
 }
 
+// Invalidate serial number and adjust checksum in IDENTIFY data
+static void invalidate_serno(ata_identify_device * id){
+  unsigned char sum = 0;
+  for (unsigned i = 0; i < sizeof(id->serial_no); i++) {
+    sum += id->serial_no[i]; sum -= id->serial_no[i] = 'X';
+  }
+#ifndef __NetBSD__
+  bool must_swap = !!isbigendian();
+  if (must_swap)
+    swapx(id->words088_255+255-88);
+#endif
+  if ((id->words088_255[255-88] & 0x00ff) == 0x00a5)
+    id->words088_255[255-88] += sum << 8;
+#ifndef __NetBSD__
+  if (must_swap)
+    swapx(id->words088_255+255-88);
+#endif
+}
+
 static char *commandstrings[]={
   "SMART ENABLE",
   "SMART DISABLE",
@@ -532,18 +551,20 @@ static char *commandstrings[]={
   "WARNING (UNDEFINED COMMAND -- CONTACT DEVELOPERS AT " PACKAGE_BUGREPORT ")\n"
 };
 
-void prettyprint(unsigned char *stuff, char *name){
-  int i,j;
+static void prettyprint(const unsigned char *p, const char *name){
   pout("\n===== [%s] DATA START (BASE-16) =====\n", name);
-  for (i=0; i<32; i++){
-    pout("%03d-%03d: ", 16*i, 16*(i+1)-1);
-    for (j=0; j<15; j++)
-      pout("%02x ",*stuff++);
-    pout("%02x\n",*stuff++);
-  }
+  for (int i=0; i<512; i+=16, p+=16)
+    // print complete line to avoid slow tty output and extra lines in syslog.
+    pout("%03d-%03d: %02x %02x %02x %02x %02x %02x %02x %02x "
+                    "%02x %02x %02x %02x %02x %02x %02x %02x\n",
+         i, i+16-1,
+         p[ 0], p[ 1], p[ 2], p[ 3], p[ 4], p[ 5], p[ 6], p[ 7],
+         p[ 8], p[ 9], p[10], p[11], p[12], p[13], p[14], p[15]);
   pout("===== [%s] DATA END (512 Bytes) =====\n\n", name);
 }
 
+static int parsedev_command_interface(int fd, smart_command_set command, int select, char * data);
+
 // This function provides the pretty-print reporting for SMART
 // commands: it implements the various -r "reporting" options for ATA
 // ioctls.
@@ -592,13 +613,9 @@ int smartcommandhandler(int device, smart_command_set command, int select, char
   }
 
 
-  // If reporting is enabled, say what input was sent to the command
-  if (con->reportataioctl && sendsdata){
-    pout("REPORT-IOCTL: DeviceFD=%d Command=%s", device, commandstrings[command]);
-    // if requested, pretty-print the output data structure
-    if (con->reportataioctl>1)
-      prettyprint((unsigned char *)data, commandstrings[command]);
-  }
+  // if requested, pretty-print the input data structure
+  if (con->reportataioctl>1 && sendsdata)
+    prettyprint((unsigned char *)data, commandstrings[command]);
 
   // In case the command produces an error, we'll want to know what it is:
   errno=0;
@@ -621,10 +638,17 @@ int smartcommandhandler(int device, smart_command_set command, int select, char
   case CONTROLLER_HPT:
     retval=highpoint_command_interface(device, command, select, data);
     break;
+  case CONTROLLER_PARSEDEV:
+    retval=parsedev_command_interface(device, command, select, data);
+    break;
   default:
     retval=ata_command_interface(device, command, select, data);
   }
 
+  // If requested, invalidate serial number before any printing is done
+  if ((command == IDENTIFY || command == PIDENTIFY) && !retval && con->dont_print_serial)
+    invalidate_serno((ata_identify_device *)data);
+
   // If reporting is enabled, say what output was produced by the command
   if (con->reportataioctl){
     if (errno)
@@ -700,7 +724,7 @@ int ataReadHDIdentity (int device, struct ata_identify_device *buf){
 
 #ifndef __NetBSD__
   // if machine is big-endian, swap byte order as needed
-  // (the NetBSD kernel does deliver the results in host byte order)
+  // NetBSD kernel delivers IDENTIFY data in host byte order
   if (isbigendian()){
     int i;
     
@@ -771,7 +795,24 @@ int ataVersionInfo (const char** description, struct ata_identify_device *drive,
       return std;
     }
   }
-  
+
+  // Try new ATA-8 minor revision numbers (Table 30 of T13/1699-D Revision 4b)
+  // (not in actual_ver/minor_str to avoid large sparse tables)
+  const char *desc;
+  switch (*minor) {
+    case 0x0027: desc = "ATA-8-ACS revision 3c"; break;
+    case 0x0029: desc = "ATA-8-ACS revision 4"; break;
+    case 0x0033: desc = "ATA-8-ACS revision 3e"; break;
+    case 0x0042: desc = "ATA-8-ACS revision 3f"; break;
+    case 0x0052: desc = "ATA-8-ACS revision 3b"; break;
+    case 0x0107: desc = "ATA-8-ACS revision 2d"; break;
+    default:     desc = 0; break;
+  }
+  if (desc) {
+    *description = desc;
+    return 8;
+  }
+
   // HDPARM has a very complicated algorithm from here on. Since SMART only
   // exists on ATA-3 and later standards, let's punt on this.  If you don't
   // like it, please fix it.  The code's in CVS.
@@ -827,7 +868,7 @@ int ataReadSmartValues(int device, struct ata_smart_values *data){
   if (checksum((unsigned char *)data))
     checksumwarning("SMART Attribute Data Structure");
   
-  // byte swap if needed
+  // swap endian order if needed
   if (isbigendian()){
     int i;
     swap2((char *)&(data->revnumber));
@@ -879,7 +920,7 @@ int ataReadSelfTestLog (int device, struct ata_smart_selftestlog *data){
   if (con->fixfirmwarebug == FIX_SAMSUNG)
     fixsamsungselftestlog(data);
 
-  // fix endian order, if needed
+  // swap endian order if needed
   if (isbigendian()){
     int i;
     swap2((char*)&(data->revnumber));
@@ -945,13 +986,17 @@ int ataReadSelectiveSelfTestLog(int device, struct ata_selective_self_test_log *
 }
 
 // Writes the selective self-test log (log #9)
-int ataWriteSelectiveSelfTestLog(int device, struct ata_smart_values *sv){   
-  int i;
+int ataWriteSelectiveSelfTestLog(int device, struct ata_smart_values *sv, uint64_t num_sectors){   
+
+  // Disk size must be known
+  if (!num_sectors) {
+    pout("Disk size is unknown, unable to check selective self-test spans\n");
+    return -1;
+  }
+
+  // Read log
   struct ata_selective_self_test_log sstlog, *data=&sstlog;
-  unsigned char cksum=0;
   unsigned char *ptr=(unsigned char *)data;
-  
-  // Read log
   if (ataReadSelectiveSelfTestLog(device, data)) {
     pout("Since Read failed, will not attempt to WRITE Selective Self-test Log\n");
     return -1;
@@ -977,7 +1022,81 @@ int ataWriteSelectiveSelfTestLog(int device, struct ata_smart_values *sv){
     pout("Error SMART Selective or other Self-Test in progress.\n");
     return -4;
   }
-  
+
+  // Set start/end values based on old spans for special -t select,... options
+  int i;
+  for (i=0; i<con->smartselectivenumspans; i++) {
+    char mode = con->smartselectivemode[i];
+    uint64_t start = con->smartselectivespan[i][0];
+    uint64_t end   = con->smartselectivespan[i][1];
+    if (mode == SEL_CONT) {// redo or next dependig on last test status
+      switch (sv->self_test_exec_status >> 4) {
+        case 1: case 2: // Aborted/Interrupted by host
+          pout("Continue Selective Self-Test: Redo last span\n");
+          mode = SEL_REDO;
+          break;
+        default: // All others
+          pout("Continue Selective Self-Test: Start next span\n");
+          mode = SEL_NEXT;
+          break;
+      }
+    }
+    switch (mode) {
+      case SEL_RANGE: // -t select,START-END
+        break;
+      case SEL_REDO: // -t select,redo... => Redo current
+        start = data->span[i].start;
+        if (end > 0) { // -t select,redo+SIZE
+          end--; end += start; // [oldstart, oldstart+SIZE)
+        }
+        else // -t select,redo
+          end = data->span[i].end; // [oldstart, oldend]
+        break;
+      case SEL_NEXT: // -t select,next... => Do next
+        if (data->span[i].end == 0) {
+          start = end = 0; break; // skip empty spans
+        }
+        start = data->span[i].end + 1;
+        if (start >= num_sectors)
+          start = 0; // wrap around
+        if (end > 0) { // -t select,next+SIZE
+          end--; end += start; // (oldend, oldend+SIZE]
+        }
+        else { // -t select,next
+          uint64_t oldsize = data->span[i].end - data->span[i].start + 1;
+          end = start + oldsize - 1; // (oldend, oldend+oldsize]
+          if (end >= num_sectors) {
+            // Adjust size to allow round-robin testing without future size decrease
+            uint64_t spans = (num_sectors + oldsize-1) / oldsize;
+            uint64_t newsize = (num_sectors + spans-1) / spans;
+            uint64_t newstart = num_sectors - newsize, newend = num_sectors - 1;
+            pout("Span %d changed from %"PRIu64"-%"PRIu64" (%"PRIu64" sectors)\n"
+                 "                 to %"PRIu64"-%"PRIu64" (%"PRIu64" sectors) (%"PRIu64" spans)\n",
+                i, start, end, oldsize, newstart, newend, newsize, spans);
+            start = newstart; end = newend;
+          }
+        }
+        break;
+      default:
+        pout("ataWriteSelectiveSelfTestLog: Invalid mode %d\n", mode);
+        return -1;
+    }
+    // Range check
+    if (start < num_sectors && num_sectors <= end) {
+      if (end != ~(uint64_t)0) // -t select,N-max
+        pout("Size of self-test span %d decreased according to disk size\n", i);
+      end = num_sectors - 1;
+    }
+    if (!(start <= end && end < num_sectors)) {
+      pout("Invalid selective self-test span %d: %"PRIu64"-%"PRIu64" (%"PRIu64" sectors)\n",
+        i, start, end, num_sectors);
+      return -1;
+    }
+    // Write back to allow ataSmartTest() to print the actual values
+    con->smartselectivespan[i][0] = start;
+    con->smartselectivespan[i][1] = end;
+  }
+
   // Clear spans
   for (i=0; i<5; i++)
     memset(data->span+i, 0, sizeof(struct test_span));
@@ -1010,17 +1129,17 @@ int ataWriteSelectiveSelfTestLog(int device, struct ata_smart_values *sv){
 
   // Set checksum to zero, then compute checksum
   data->checksum=0;
+  unsigned char cksum=0;
   for (i=0; i<512; i++)
     cksum+=ptr[i];
   cksum=~cksum;
   cksum+=1;
   data->checksum=cksum;
 
-    // swap endian order if needed
+  // swap endian order if needed
   if (isbigendian()){
-    int i;
     swap2((char *)&(data->logversion));
-    for (i=0;i<5;i++){
+    for (int i=0;i<5;i++){
       swap8((char *)&(data->span[i].start));
       swap8((char *)&(data->span[i].end));
     }
@@ -1092,7 +1211,7 @@ int ataReadErrorLog (int device, struct ata_smart_errorlog *data){
   else if (con->fixfirmwarebug == FIX_SAMSUNG2)
     fixsamsungerrorlog2(data);
 
-  // Correct endian order if necessary
+  // swap endian order if needed
   if (isbigendian()){
     int i,j;
     
@@ -1125,7 +1244,7 @@ int ataReadSmartThresholds (int device, struct ata_smart_thresholds_pvt *data){
   if (checksum((unsigned char *)data))
     checksumwarning("SMART Attribute Thresholds Structure");
   
-  // byte swap if needed
+  // swap endian order if needed
   if (isbigendian())
     swap2((char *)&(data->revnumber));
 
@@ -1212,7 +1331,8 @@ int ataSmartStatus2(int device){
 
 // This is the way to execute ALL tests: offline, short self-test,
 // extended self test, with and without captive mode, etc.
-int ataSmartTest(int device, int testtype, struct ata_smart_values *sv) {     
+int ataSmartTest(int device, int testtype, struct ata_smart_values *sv, uint64_t num_sectors)
+{
   char cmdmsg[128],*type,*captive;
   int errornum, cap, retval, select=0;
 
@@ -1240,7 +1360,7 @@ int ataSmartTest(int device, int testtype, struct ata_smart_values *sv) {
   
   // If doing a selective self-test, first use WRITE_LOG to write the
   // selective self-test log.
-  if (select && (retval=ataWriteSelectiveSelfTestLog(device, sv))) {
+  if (select && (retval=ataWriteSelectiveSelfTestLog(device, sv, num_sectors))) {
     if (retval==-4)
       pout("Can't start selective self-test without aborting current test: use '-X' option to smartctl.\n");
     return retval;
@@ -1484,6 +1604,32 @@ int ataCheckAttribute(struct ata_smart_values *data,
 }
 
 
+// Print temperature value and Min/Max value if present
+static void ataPrintTemperatureValue(char *out, const unsigned char *raw, const unsigned *word)
+{
+  out+=sprintf(out, "%u", word[0]);
+  if (!word[1] && !word[2])
+    return; // No Min/Max
+
+  unsigned lo = ~0, hi = ~0;
+  if (!raw[3]) {
+    // 00 HH 00 LL 00 TT (IBM)
+    hi = word[2]; lo = word[1];
+  }
+  else if (!word[2]) {
+    // 00 00 HH LL 00 TT (Maxtor)
+    hi = raw[3]; lo = raw[2];
+  }
+  if (lo > hi) {
+    unsigned t = lo; lo = hi; hi = t;
+  }
+  if (lo <= word[0] && word[0] <= hi)
+    sprintf(out, " (Lifetime Min/Max %u/%u)", lo, hi);
+  else
+    sprintf(out, " (%u %u %u %u)", raw[5], raw[4], raw[3], raw[2]);
+}
+
+
 // This routine prints the raw value of an attribute as a text string
 // into out. It also returns this 48-bit number as a long long.  The
 // array defs[] contains non-zero values if particular attributes have
@@ -1579,6 +1725,10 @@ int64_t ataPrintSmartAttribRawValue(char *out,
       // hours
       out+=sprintf(out, "%"PRIu64, rawvalue);  //stored in hours
     break;
+    // Temperature
+  case 190:
+    ataPrintTemperatureValue(out, attribute->raw, word);
+    break;
    // Load unload cycles
   case 193:
     if (select==1){
@@ -1602,15 +1752,8 @@ int64_t ataPrintSmartAttribRawValue(char *out,
     else if (select==2)
       // unknown attribute
       out+=sprintf(out, "%"PRIu64, rawvalue);
-    else {
-      out+=sprintf(out, "%d", word[0]);
-      if (!(rawvalue==word[0])) {
-       int min=word[1]<word[2]?word[1]:word[2];
-       int max=word[1]>word[2]?word[1]:word[2];
-        // The other bytes are in use. Try IBM's model
-        out+=sprintf(out, " (Lifetime Min/Max %d/%d)", min, max);
-      }
-    }
+    else
+      ataPrintTemperatureValue(out, attribute->raw, word);
     break;
   default:
     out+=sprintf(out, "%"PRIu64, rawvalue);
@@ -1692,6 +1835,12 @@ void ataPrintSmartAttribName(char *out, unsigned char id, unsigned char *definit
   case 13:
     name="Read_Soft_Error_Rate";
     break;
+  case 187:
+    name="Reported_Uncorrect";
+    break;
+  case 189:
+    name="High_Fly_Writes";
+    break;
   case 190:
     // Western Digital uses this for temperature.
     // It's identical to Attribute 194 except that it
@@ -1700,7 +1849,7 @@ void ataPrintSmartAttribName(char *out, unsigned char id, unsigned char *definit
     // is typically 55C.  So if this attribute has failed
     // in the past, it indicates that the drive temp exceeded
     // 55C sometime in the past.
-    name="Temperature_Celsius";
+    name="Airflow_Temperature_Cel";
     break;
   case 191:
     name="G-Sense_Error_Rate";
@@ -1934,3 +2083,399 @@ unsigned char ATAReturnTemperatureValue(/*const*/ struct ata_smart_values *data,
   // No valid attribute found
   return 0;
 }
+
+// Read SCT Status
+int ataReadSCTStatus(int device, ata_sct_status_response * sts)
+{
+  // read SCT status via SMART log 0xe0
+  memset(sts, 0, sizeof(*sts));
+  if (smartcommandhandler(device, READ_LOG, 0xe0, (char *)sts)){
+    syserror("Error Read SCT Status failed");
+    return -1;
+  }
+
+  // swap endian order if needed
+  if (isbigendian()){
+    swapx(&sts->format_version);
+    swapx(&sts->sct_version);
+    swapx(&sts->sct_spec);
+    swapx(&sts->ext_status_code);
+    swapx(&sts->action_code);
+    swapx(&sts->function_code);
+    swapx(&sts->over_limit_count);
+    swapx(&sts->under_limit_count);
+  }
+
+  // Check format version
+  if (!(sts->format_version == 2 || sts->format_version == 3)) {
+    pout("Error unknown SCT Status format version %u, should be 2 or 3.\n", sts->format_version);
+    return -1;
+  }
+  return 0;
+}
+
+// Read SCT Temperature History Table and Status
+int ataReadSCTTempHist(int device, ata_sct_temperature_history_table * tmh,
+                       ata_sct_status_response * sts)
+{
+  // Check initial status
+  if (ataReadSCTStatus(device, sts))
+    return -1;
+
+  // Do nothing if other SCT command is executing
+  if (sts->ext_status_code == 0xffff) {
+    pout("Another SCT command is executing, abort Read Data Table\n"
+         "(SCT ext_status_code 0x%04x, action_code=%u, function_code=%u)\n",
+      sts->ext_status_code, sts->action_code, sts->function_code);
+    return -1;
+  }
+
+  ata_sct_data_table_command cmd; memset(&cmd, 0, sizeof(cmd));
+  // CAUTION: DO NOT CHANGE THIS VALUE (SOME ACTION CODES MAY ERASE DISK)
+  cmd.action_code   = 5; // Data table command
+  cmd.function_code = 1; // Read table
+  cmd.table_id      = 2; // Temperature History Table
+
+  // write command via SMART log page 0xe0
+  if (smartcommandhandler(device, WRITE_LOG, 0xe0, (char *)&cmd)){
+    syserror("Error Write SCT Data Table command failed");
+    return -1;
+  }
+
+  // read SCT data via SMART log page 0xe1
+  memset(tmh, 0, sizeof(*tmh));
+  if (smartcommandhandler(device, READ_LOG, 0xe1, (char *)tmh)){
+    syserror("Error Read SCT Data Table failed");
+    return -1;
+  }
+
+  // re-read and check SCT status
+  if (ataReadSCTStatus(device, sts))
+    return -1;
+
+  if (!(sts->ext_status_code == 0 && sts->action_code == 5 && sts->function_code == 1)) {
+    pout("Error unexcepted SCT status 0x%04x (action_code=%u, function_code=%u)\n",
+      sts->ext_status_code, sts->action_code, sts->function_code);
+    return -1;
+  }
+
+  // swap endian order if needed
+  if (isbigendian()){
+    swapx(&tmh->format_version);
+    swapx(&tmh->sampling_period);
+    swapx(&tmh->interval);
+  }
+
+  // Check format version
+  if (tmh->format_version != 2) {
+    pout("Error unknown SCT Temperature History Format Version (%u), should be 2.\n", tmh->format_version);
+    return -1;
+  }
+  return 0;
+}
+
+// Set SCT Temperature Logging Interval
+int ataSetSCTTempInterval(int device, unsigned interval, bool persistent)
+{
+  // Check initial status
+  ata_sct_status_response sts;
+  if (ataReadSCTStatus(device, &sts))
+    return -1;
+
+  // Do nothing if other SCT command is executing
+  if (sts.ext_status_code == 0xffff) {
+    pout("Another SCT command is executing, abort Feature Control\n"
+         "(SCT ext_status_code 0x%04x, action_code=%u, function_code=%u)\n",
+      sts.ext_status_code, sts.action_code, sts.function_code);
+    return -1;
+  }
+
+  ata_sct_feature_control_command cmd; memset(&cmd, 0, sizeof(cmd));
+  // CAUTION: DO NOT CHANGE THIS VALUE (SOME ACTION CODES MAY ERASE DISK)
+  cmd.action_code   = 4; // Feature Control command
+  cmd.function_code = 1; // Set state
+  cmd.feature_code  = 3; // Temperature logging interval
+  cmd.state         = interval;
+  cmd.option_flags  = (persistent ? 0x01 : 0x00);
+
+  // write command via SMART log page 0xe0
+  if (smartcommandhandler(device, WRITE_LOG, 0xe0, (char *)&cmd)){
+    syserror("Error Write SCT Feature Control Command failed");
+    return -1;
+  }
+
+  // re-read and check SCT status
+  if (ataReadSCTStatus(device, &sts))
+    return -1;
+
+  if (!(sts.ext_status_code == 0 && sts.action_code == 4 && sts.function_code == 1)) {
+    pout("Error unexcepted SCT status 0x%04x (action_code=%u, function_code=%u)\n",
+      sts.ext_status_code, sts.action_code, sts.function_code);
+    return -1;
+  }
+  return 0;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+// Pseudo-device to parse "smartctl -r ataioctl,2 ..." output and simulate
+// an ATA device with same behaviour
+
+// Table of parsed commands, return value, data
+struct parsed_ata_command
+{ 
+  smart_command_set command;
+  int select;
+  int retval, errval;
+  char * data;
+};
+
+const int max_num_parsed_commands = 32;
+static parsed_ata_command parsed_command_table[max_num_parsed_commands];
+static int num_parsed_commands;
+static int next_replay_command;
+static bool replay_out_of_sync;
+
+
+static const char * nextline(const char * s, int & lineno)
+{
+  for (s += strcspn(s, "\r\n"); *s == '\r' || *s == '\n'; s++) {
+    if (*s == '\r' && s[1] == '\n')
+      s++;
+    lineno++;
+  }
+  return s;
+}
+
+static int name2command(const char * s)
+{
+  for (int i = 0; i < (int)(sizeof(commandstrings)/sizeof(commandstrings[0])); i++) {
+    if (!strcmp(s, commandstrings[i]))
+      return i;
+  }
+  return -1;
+}
+
+static bool matchcpy(char * dest, size_t size, const char * src, const regmatch_t & srcmatch)
+{
+  if (srcmatch.rm_so < 0)
+    return false;
+  size_t n = srcmatch.rm_eo - srcmatch.rm_so;
+  if (n >= size)
+    n = size-1;
+  memcpy(dest, src + srcmatch.rm_so, n);
+  dest[n] = 0;
+  return true;
+}
+
+static inline int matchtoi(const char * src, const regmatch_t & srcmatch, int defval)
+{
+  if (srcmatch.rm_so < 0)
+    return defval;
+  return atoi(src + srcmatch.rm_so);
+}
+
+
+// Parse stdin and build command table
+int parsedev_open(const char * pathname)
+{
+  if (strcmp(pathname, "-")) {
+    errno = EINVAL; return -1;
+  }
+  pathname = "<stdin>";
+  // Fill buffer
+  char buffer[64*1024];
+  int size = 0;
+  while (size < (int)sizeof(buffer)) {
+    int nr = fread(buffer, 1, sizeof(buffer), stdin);
+    if (nr <= 0)
+      break;
+    size += nr;
+  }
+  if (size <= 0) {
+    pout("%s: Unexpected EOF\n", pathname);
+    errno = ENOENT; return -1;
+  }
+  if (size >= (int)sizeof(buffer)) {
+    pout("%s: Buffer overflow\n", pathname);
+    errno = EIO; return -1;
+  }
+  buffer[size] = 0;
+
+  // Regex to match output from "-r ataioctl,2"
+  static const char pattern[] = "^"
+  "(" // (1
+    "REPORT-IOCTL: DeviceFD=[0-9]+ Command=([A-Z ]*[A-Z])" // (2)
+    "(" // (3
+      "( InputParameter=([0-9]+))?" // (4 (5))
+    "|"
+      "( returned (-?[0-9]+)( errno=([0-9]+)[^\r\n]*)?)" // (6 (7) (8 (9)))
+    ")" // )
+    "[\r\n]" // EOL match necessary to match optional parts above
+  "|"
+    "===== \\[([A-Z ]*[A-Z])\\] DATA START " // (10)
+  ")"; // )
+
+  // Compile regex
+  regex_t rex;
+  if (compileregex(&rex, pattern, REG_EXTENDED)) {
+    errno = EIO; return -1;
+  }
+
+  // Parse buffer
+  const char * errmsg = 0;
+  int i = -1, state = 0, lineno = 1;
+  for (const char * line = buffer; *line; line = nextline(line, lineno)) {
+    // Match line
+    if (!(line[0] == 'R' || line[0] == '='))
+      continue;
+    const int nmatch = 1+10;
+    regmatch_t match[nmatch];
+    if (regexec(&rex, line, nmatch, match, 0))
+      continue;
+
+    char cmdname[40];
+    if (matchcpy(cmdname, sizeof(cmdname), line, match[2])) { // "REPORT-IOCTL:... Command=%s ..."
+      int nc = name2command(cmdname);
+      if (nc < 0) {
+        errmsg = "Unknown ATA command name"; break;
+      }
+      if (match[7].rm_so < 0) { // "returned %d"
+        // Start of command
+        if (!(state == 0 || state == 2)) {
+          errmsg = "Missing REPORT-IOCTL result"; break;
+        }
+        if (++i >= max_num_parsed_commands) {
+          errmsg = "Too many ATA commands"; break;
+        }
+        parsed_command_table[i].command = (smart_command_set)nc;
+        parsed_command_table[i].select = matchtoi(line, match[5], 0); // "InputParameter=%d"
+        state = 1;
+      }
+      else {
+        // End of command
+        if (!(state == 1 && (int)parsed_command_table[i].command == nc)) {
+          errmsg = "Missing REPORT-IOCTL start"; break;
+        }
+        parsed_command_table[i].retval = matchtoi(line, match[7], -1); // "returned %d"
+        parsed_command_table[i].errval = matchtoi(line, match[9], 0); // "errno=%d"
+        state = 2;
+      }
+    }
+    else if (matchcpy(cmdname, sizeof(cmdname), line, match[10])) { // "===== [%s] DATA START "
+      // Start of sector hexdump
+      int nc = name2command(cmdname);
+      if (!(state == (nc == WRITE_LOG ? 1 : 2) && (int)parsed_command_table[i].command == nc)) {
+          errmsg = "Unexpected DATA START"; break;
+      }
+      line = nextline(line, lineno);
+      char * data = (char *)malloc(512);
+      unsigned j;
+      for (j = 0; j < 32; j++) {
+        unsigned b[16];
+        unsigned u1, u2; int n1 = -1;
+        if (!(sscanf(line, "%3u-%3u: "
+                        "%2x %2x %2x %2x %2x %2x %2x %2x "
+                        "%2x %2x %2x %2x %2x %2x %2x %2x%n",
+                     &u1, &u2,
+                     b+ 0, b+ 1, b+ 2, b+ 3, b+ 4, b+ 5, b+ 6, b+ 7,
+                     b+ 8, b+ 9, b+10, b+11, b+12, b+13, b+14, b+15, &n1) == 18
+              && n1 >= 56 && u1 == j*16 && u2 == j*16+15))
+          break;
+        for (unsigned k = 0; k < 16; k++)
+          data[j*16+k] = b[k];
+        line = nextline(line, lineno);
+      }
+      if (j < 32) {
+        free(data);
+        errmsg = "Incomplete sector hex dump"; break;
+      }
+      parsed_command_table[i].data = data;
+      if (nc != WRITE_LOG)
+        state = 0;
+    }
+  }
+
+  if (!(state == 0 || state == 2))
+    errmsg = "Missing REPORT-IOCTL result";
+
+  if (!errmsg && i < 0)
+    errmsg = "No information found";
+
+  num_parsed_commands = i+1;
+  next_replay_command = 0;
+  replay_out_of_sync = false;
+
+  if (errmsg) {
+    pout("%s(%d): Syntax error: %s\n", pathname, lineno, errmsg);
+    errno = EIO;
+    parsedev_close(0);
+    return -1;
+  }
+  return 0;
+}
+
+// Report warnings and free command table 
+void parsedev_close(int /*fd*/)
+{
+  if (replay_out_of_sync)
+      pout("REPLAY-IOCTL: Warning: commands replayed out of sync\n");
+  else if (next_replay_command != 0)
+      pout("REPLAY-IOCTL: Warning: %d command(s) not replayed\n", num_parsed_commands-next_replay_command);
+
+  for (int i = 0; i < num_parsed_commands; i++) {
+    if (parsed_command_table[i].data) {
+      free(parsed_command_table[i].data); parsed_command_table[i].data = 0;
+    }
+  }
+  num_parsed_commands = 0;
+}
+
+// Simulate ATA command from command table
+static int parsedev_command_interface(int /*fd*/, smart_command_set command, int select, char * data)
+{
+  // Find command, try round-robin of out of sync
+  int i = next_replay_command;
+  for (int j = 0; ; j++) {
+    if (j >= num_parsed_commands) {
+      pout("REPLAY-IOCTL: Warning: Command not found\n");
+      errno = ENOSYS;
+      return -1;
+    }
+    if (parsed_command_table[i].command == command && parsed_command_table[i].select == select)
+      break;
+    if (!replay_out_of_sync) {
+      replay_out_of_sync = true;
+      pout("REPLAY-IOCTL: Warning: Command #%d is out of sync\n", i+1);
+    }
+    if (++i >= num_parsed_commands)
+      i = 0;
+  }
+  next_replay_command = i;
+  if (++next_replay_command >= num_parsed_commands)
+    next_replay_command = 0;
+
+  // Return command data
+  switch (command) {
+    case IDENTIFY:
+    case PIDENTIFY:
+    case READ_VALUES:
+    case READ_THRESHOLDS:
+    case READ_LOG:
+      if (parsed_command_table[i].data)
+        memcpy(data, parsed_command_table[i].data, 512);
+      break;
+    case WRITE_LOG:
+      if (!(parsed_command_table[i].data && !memcmp(data, parsed_command_table[i].data, 512)))
+        pout("REPLAY-IOCTL: Warning: WRITE LOG data does not match\n");
+      break;
+    case CHECK_POWER_MODE:
+      data[0] = (char)0xff;
+    default:
+      break;
+  }
+
+  if (parsed_command_table[i].errval)
+    errno = parsed_command_table[i].errval;
+  return parsed_command_table[i].retval;
+}
index b97b9daf999a1ac2de7c684c5d099dbdf95710f7..5f69c9c4b82e5519eb7fe25b17d6c939c75e36a9 100644 (file)
--- a/atacmds.h
+++ b/atacmds.h
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,7 @@
 #ifndef ATACMDS_H_
 #define ATACMDS_H_
 
-#define ATACMDS_H_CVSID "$Id: atacmds.h,v 1.83 2006/08/25 06:06:24 sxzzsf Exp $\n"
+#define ATACMDS_H_CVSID "$Id: atacmds.h,v 1.89 2007/07/26 20:58:50 chrfranke Exp $\n"
 
 // Macro to check expected size of struct at compile time using a
 // dummy typedef.  On size mismatch, compiler reports a negative array
@@ -372,6 +372,92 @@ ASSERT_SIZEOF_STRUCT(ata_selective_self_test_log, 512);
 #define SELECTIVE_FLAG_PENDING (0x0008)
 #define SELECTIVE_FLAG_ACTIVE  (0x0010)
 
+
+// SCT (SMART Command Transport) data structures
+// See Sections 8.2 and 8.3 of:
+//   AT Attachment 8 - ATA/ATAPI Command Set (ATA8-ACS)
+//   T13/1699-D Revision 3f (Working Draft), December 11, 2006.
+
+// SCT Status response (read with SMART_READ_LOG page 0xe0)
+// Table 60 of T13/1699-D Revision 3f 
+#pragma pack(1)
+struct ata_sct_status_response
+{
+  unsigned short format_version;    // 0-1: Status response format version number (2, 3)
+  unsigned short sct_version;       // 2-3: Vendor specific version number
+  unsigned short sct_spec;          // 4-5: SCT level supported (1)
+  unsigned int status_flags;        // 6-9: Status flags (Bit 0: Segment initialized, Bits 1-31: reserved)
+  unsigned char device_state;       // 10: Device State (0-5)
+  unsigned char bytes011_013[3];    // 11-13: reserved
+  unsigned short ext_status_code;   // 14-15: Status of last SCT command (0xffff if executing)
+  unsigned short action_code;       // 16-17: Action code of last SCT command
+  unsigned short function_code;     // 18-19: Function code of last SCT command
+  unsigned char bytes020_039[20];   // 20-39: reserved
+  uint64_t lba_current;             // 40-47: LBA of SCT command executing in background
+  unsigned char bytes048_199[152];  // 48-199: reserved
+  signed char hda_temp;             // 200: Current temperature in Celsius (0x80 = invalid)
+  signed char min_temp;             // 201: Minimum temperature this power cycle
+  signed char max_temp;             // 202: Maximum temperature this power cycle
+  signed char life_min_temp;        // 203: Minimum lifetime temperature
+  signed char life_max_temp;        // 204: Maximum lifetime temperature
+  unsigned char byte205;            // 205: reserved (T13/e06152r0-2: Average lifetime temperature)
+  unsigned int over_limit_count;    // 206-209: # intervals since last reset with temperature > Max Op Limit
+  unsigned int under_limit_count;   // 210-213: # intervals since last reset with temperature < Min Op Limit
+  unsigned char bytes214_479[266];  // 214-479: reserved
+  unsigned char vendor_specific[32];// 480-511: vendor specific
+} ATTR_PACKED;
+#pragma pack()
+ASSERT_SIZEOF_STRUCT(ata_sct_status_response, 512);
+
+// SCT Feature Control command (send with SMART_WRITE_LOG page 0xe0)
+// Table 72 of T13/1699-D Revision 3f
+#pragma pack(1)
+struct ata_sct_feature_control_command
+{
+  unsigned short action_code;       // 4 = Feature Control
+  unsigned short function_code;     // 1 = Set, 2 = Return, 3 = Return options
+  unsigned short feature_code;      // 3 = Temperature logging interval
+  unsigned short state;             // Interval
+  unsigned short option_flags;      // Bit 0: persistent, Bits 1-31: reserved
+  unsigned short words005_255[251]; // reserved 
+} ATTR_PACKED;
+#pragma pack()
+ASSERT_SIZEOF_STRUCT(ata_sct_feature_control_command, 512);
+
+// SCT Data Table command (send with SMART_WRITE_LOG page 0xe0)
+// Table 73 of T13/1699-D Revision 3f 
+#pragma pack(1)
+struct ata_sct_data_table_command
+{
+  unsigned short action_code;       // 5 = Data Table
+  unsigned short function_code;     // 1 = Read Table
+  unsigned short table_id;          // 2 = Temperature History
+  unsigned short words003_255[253]; // reserved
+} ATTR_PACKED;
+#pragma pack()
+ASSERT_SIZEOF_STRUCT(ata_sct_data_table_command, 512);
+
+// SCT Temperature History Table (read with SMART_READ_LOG page 0xe1)
+// Table 75 of T13/1699-D Revision 3f 
+#pragma pack(1)
+struct ata_sct_temperature_history_table
+{
+  unsigned short format_version;    // 0-1: Data table format version number (2)
+  unsigned short sampling_period;   // 2-3: Temperature sampling period in minutes
+  unsigned short interval;          // 4-5: Timer interval between history entries
+  signed char max_op_limit;         // 6: Maximum recommended continuous operating temperature
+  signed char over_limit;           // 7: Maximum temperature limit
+  signed char min_op_limit;         // 8: Minimum recommended continuous operating limit
+  signed char under_limit;          // 9: Minimum temperature limit
+  unsigned char bytes010_029[20];   // 10-29: reserved
+  unsigned short cb_size;           // 30-31: Number of history entries (range 128-478)
+  unsigned short cb_index;          // 32-33: Index of last updated entry (zero-based)
+  signed char cb[478];              // 34-(34+cb_size-1): Circular buffer of temperature values
+} ATTR_PACKED;
+#pragma pack()
+ASSERT_SIZEOF_STRUCT(ata_sct_temperature_history_table, 512);
+
+
 // Get information from drive
 int ataReadHDIdentity(int device, struct ata_identify_device *buf);
 int ataCheckPowerMode(int device);
@@ -384,7 +470,15 @@ int ataReadSelfTestLog(int device, struct ata_smart_selftestlog *);
 int ataReadSelectiveSelfTestLog(int device, struct ata_selective_self_test_log *data);
 int ataSmartStatus(int device);
 int ataSetSmartThresholds(int device, struct ata_smart_thresholds_pvt *);
-int ataReadLogDirectory(int device, struct ata_smart_log_directory *);  
+int ataReadLogDirectory(int device, struct ata_smart_log_directory *);
+
+// Read SCT information
+int ataReadSCTStatus(int device, ata_sct_status_response * sts);
+int ataReadSCTTempHist(int device, ata_sct_temperature_history_table * tmh,
+                       ata_sct_status_response * sts);
+// Set SCT temperature logging interval
+int ataSetSCTTempInterval(int device, unsigned interval, bool persistent);
+
 
 /* Enable/Disable SMART on device */
 int ataEnableSmart ( int device );
@@ -455,7 +549,16 @@ int isSupportConveyanceSelfTest(struct ata_smart_values *data);
 
 int isSupportSelectiveSelfTest(struct ata_smart_values *data);
 
-int ataSmartTest(int device, int testtype, struct ata_smart_values *data);
+inline bool isSCTCapable(const ata_identify_device *drive)
+  { return !!(drive->words088_255[206-88] & 0x01); } // 0x01 = SCT support
+
+inline bool isSCTFeatureControlCapable(const ata_identify_device *drive)
+  { return ((drive->words088_255[206-88] & 0x11) == 0x11); } // 0x10 = SCT Feature Control support
+
+inline bool isSCTDataTableCapable(const ata_identify_device *drive)
+  { return ((drive->words088_255[206-88] & 0x21) == 0x21); } // 0x20 = SCT Data Table support
+
+int ataSmartTest(int device, int testtype, struct ata_smart_values *data, uint64_t num_sectors);
 
 int TestTime(struct ata_smart_values *data,int testtype);
 
@@ -526,6 +629,11 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
 int escalade_command_interface(int fd, int escalade_port, int escalade_type, smart_command_set command, int select, char *data);
 int marvell_command_interface(int device, smart_command_set command, int select, char *data);
 int highpoint_command_interface(int device, smart_command_set command, int select, char *data);
+
+// "smartctl -r ataioctl,2 ..." output parser pseudo-device
+int parsedev_open(const char * name);
+void parsedev_close(int fd);
+
 // Optional functions of os_*.c
 #ifdef HAVE_ATA_IDENTIFY_IS_CACHED
 // Return true if OS caches the ATA identify sector
@@ -539,4 +647,12 @@ int smartcommandhandler(int device, smart_command_set command, int select, char
 void swap2(char *location);
 void swap4(char *location);
 void swap8(char *location);
+// Typesafe variants using overloading
+inline void swapx(unsigned short * p)
+  { swap2((char*)p); }
+inline void swapx(unsigned int * p)
+  { swap4((char*)p); }
+inline void swapx(uint64_t * p)
+  { swap8((char*)p); }
+
 #endif /* ATACMDS_H_ */
index d58364cc28ee27c3ac7806e273ec26b4f34c1dbb..72bef894243b789de517475c7aa70d743d1afeda 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -41,7 +41,7 @@
 #include "utility.h"
 #include "knowndrives.h"
 
-const char *ataprint_c_cvsid="$Id: ataprint.cpp,v 1.171 2006/10/28 11:51:25 chrfranke Exp $"
+const char *ataprint_c_cvsid="$Id: ataprint.cpp,v 1.183 2007/07/21 20:59:41 chrfranke Exp $"
 ATACMDNAMES_H_CVSID ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // for passing global control variables
@@ -91,28 +91,27 @@ void trim(char *out, const char *in)
 }
 
 // Convenience function for formatting strings from ata_identify_device
-void formatdriveidstring(char *out, const char *in, int n)
+void format_ata_string(char *out, const char *in, int n)
 {
-  char tmp[65];
-
-  n = n > 64 ? 64 : n;
+  bool must_swap = !con->fixswappedid;
 #ifndef __NetBSD__
-  swapbytes(tmp, in, n);
-#else
+  /* NetBSD kernel delivers IDENTIFY data in host byte order (but all else is LE) */
   if (isbigendian())
+    must_swap = !must_swap;
+#endif
+
+  char tmp[65];
+  n = n > 64 ? 64 : n;
+  if (!must_swap)
     strncpy(tmp, in, n);
   else
     swapbytes(tmp, in, n);
-#endif
   tmp[n] = '\0';
   trim(out, tmp);
 }
 
-void infofound(char *output) {
-  if (*output)
-    pout("%s\n", output);
-  else
-    pout("[No Information Found]\n");
+static const char * infofound(const char *output) {
+  return (*output ? output : "[No Information Found]");
 }
 
 
@@ -433,12 +432,12 @@ char *construct_st_er_desc(struct ata_smart_errorlog_struct *data) {
   return s;
 }
 
-// This returns the capacity of a disk drive and also prints this into
-// a string, using comma separators to make it easier to read.  If the
-// drive doesn't support LBA addressing or has no user writable
-// sectors (eg, CDROM or DVD) then routine returns zero.
-uint64_t determine_capacity(struct ata_identify_device *drive, char *pstring){
 
+// Get number of sectors from IDENTIFY sector. If the drive doesn't
+// support LBA addressing or has no user writable sectors
+// (eg, CDROM or DVD) then routine returns zero.
+static uint64_t get_num_sectors(const ata_identify_device *drive)
+{
   unsigned short command_set_2  = drive->command_set_2;
   unsigned short capabilities_0 = drive->words047_079[49-47];
   unsigned short sects_16       = drive->words047_079[60-47];
@@ -447,46 +446,56 @@ uint64_t determine_capacity(struct ata_identify_device *drive, char *pstring){
   unsigned short lba_32         = drive->words088_255[101-88];
   unsigned short lba_48         = drive->words088_255[102-88];
   unsigned short lba_64         = drive->words088_255[103-88];
-  uint64_t capacity_short=0, capacity=0, threedigits, power_of_ten;
-  int started=0,k=1000000000;
-  char *separator=",";
+
+  // LBA support?
+  if (!(capabilities_0 & 0x0200))
+    return 0; // No
+
+  // if drive supports LBA addressing, determine 32-bit LBA capacity
+  uint64_t lba32 = (unsigned int)sects_32 << 16 | 
+                   (unsigned int)sects_16 << 0  ;
+
+  uint64_t lba64 = 0;
+  // if drive supports 48-bit addressing, determine THAT capacity
+  if ((command_set_2 & 0xc000) == 0x4000 && (command_set_2 & 0x0400))
+      lba64 = (uint64_t)lba_64 << 48 | 
+              (uint64_t)lba_48 << 32 |
+              (uint64_t)lba_32 << 16 | 
+              (uint64_t)lba_16 << 0  ;
+
+  // return the larger of the two possible capacities
+  return (lba32 > lba64 ? lba32 : lba64);
+}
+
+
+// This returns the capacity of a disk drive and also prints this into
+// a string, using comma separators to make it easier to read.  If the
+// drive doesn't support LBA addressing or has no user writable
+// sectors (eg, CDROM or DVD) then routine returns zero.
+uint64_t determine_capacity(struct ata_identify_device *drive, char *pstring){
 
   // get correct character to use as thousands separator
+  char *separator=",";
 #ifdef HAVE_LOCALE_H
   struct lconv *currentlocale=NULL;
   setlocale (LC_ALL, "");
   currentlocale=localeconv();
   if (*(currentlocale->thousands_sep))
-    separator=currentlocale->thousands_sep;
+    separator=(char *)currentlocale->thousands_sep;
 #endif // #ifdef HAVE_LOCALE_H
 
-  // if drive supports LBA addressing, determine 32-bit LBA capacity
-  if (capabilities_0 & 0x0200) {
-    capacity_short = (unsigned int)sects_32 << 16 | 
-                     (unsigned int)sects_16 << 0  ;
-    
-    // if drive supports 48-bit addressing, determine THAT capacity
-    if ((command_set_2 & 0xc000) == 0x4000 && (command_set_2 & 0x0400))
-      capacity = (uint64_t)lba_64 << 48 | 
-                (uint64_t)lba_48 << 32 |
-                (uint64_t)lba_32 << 16 | 
-                (uint64_t)lba_16 << 0  ;
-    
-    // choose the larger of the two possible capacities
-    if (capacity_short>capacity)
-      capacity=capacity_short;
-  }
+  // get #sectors and turn into bytes
+  uint64_t capacity = get_num_sectors(drive) * 512;
+  uint64_t retval = capacity;
 
-  // turn sectors into bytes
-  capacity_short = (capacity *= 512);
-  
   // print with locale-specific separators (default is comma)
-  power_of_ten =  k;
+  int started=0, k=1000000000;
+  uint64_t power_of_ten = k;
   power_of_ten *= k;
   
   for (k=0; k<7; k++) {
-    threedigits = capacity/power_of_ten;
-    capacity   -= threedigits*power_of_ten;
+    uint64_t threedigits = capacity/power_of_ten;
+    capacity -= threedigits*power_of_ten;
     if (started)
       // we have already printed some digits
       pstring += sprintf(pstring, "%s%03"PRIu64, separator, threedigits);
@@ -499,7 +508,7 @@ uint64_t determine_capacity(struct ata_identify_device *drive, char *pstring){
       power_of_ten /= 1000;
   }
   
-  return capacity_short;
+  return retval;
 }
 
 int ataPrintDriveInfo (struct ata_identify_device *drive){
@@ -510,9 +519,9 @@ int ataPrintDriveInfo (struct ata_identify_device *drive){
   char model[64], serial[64], firm[64], capacity[64];
 
   // format drive information (with byte swapping as needed)
-  formatdriveidstring(model, (char *)drive->model,40);
-  formatdriveidstring(serial, (char *)drive->serial_no,20);
-  formatdriveidstring(firm, (char *)drive->fw_rev,8);
+  format_ata_string(model, (char *)drive->model,40);
+  format_ata_string(serial, (char *)drive->serial_no,20);
+  format_ata_string(firm, (char *)drive->fw_rev,8);
 
   // print out model, serial # and firmware versions  (byte-swap ASCI strings)
   drivetype=lookupdrive(model, firm);
@@ -521,12 +530,10 @@ int ataPrintDriveInfo (struct ata_identify_device *drive){
   if (drivetype>=0 && knowndrives[drivetype].modelfamily)
     pout("Model Family:     %s\n", knowndrives[drivetype].modelfamily);
 
-  pout("Device Model:     ");
-  infofound(model);
-  pout("Serial Number:    ");
-  infofound(serial);
-  pout("Firmware Version: ");
-  infofound(firm);
+  pout("Device Model:     %s\n", infofound(model));
+  if (!con->dont_print_serial)
+    pout("Serial Number:    %s\n", infofound(serial));
+  pout("Firmware Version: %s\n", infofound(firm));
 
   if (determine_capacity(drive, capacity))
     pout("User Capacity:    %s bytes\n", capacity);
@@ -676,11 +683,26 @@ void PrintSmartSelfExecStatus(struct ata_smart_values *data)
                   (int)data->self_test_exec_status);
           pout("the read element of the test failed.\n");
           break;
-       case 15:
-          pout("(%4d)\tSelf-test routine in progress...\n\t\t\t\t\t",
+       case 8:
+          pout("(%4d)\tThe previous self-test completed having\n\t\t\t\t\t",
                   (int)data->self_test_exec_status);
-          pout("%1d0%% of test remaining.\n", 
+          pout("a test element that failed and the\n\t\t\t\t\t");
+          pout("device is suspected of having handling\n\t\t\t\t\t");
+          pout("damage.\n");
+          break;
+       case 15:
+          if (con->fixfirmwarebug == FIX_SAMSUNG3 && data->self_test_exec_status == 0xf0) {
+            pout("(%4d)\tThe previous self-test routine completed\n\t\t\t\t\t",
+                    (int)data->self_test_exec_status);
+            pout("with unknown result or self-test in\n\t\t\t\t\t");
+            pout("progress with less than 10%% remaining.\n");
+          }
+          else {
+            pout("(%4d)\tSelf-test routine in progress...\n\t\t\t\t\t",
+                    (int)data->self_test_exec_status);
+            pout("%1d0%% of test remaining.\n", 
                   (int)(data->self_test_exec_status & 0x0f));
+          }
           break;
        default:
           pout("(%4d)\tReserved.\n",
@@ -887,6 +909,20 @@ void PrintSmartAttribWithThres (struct ata_smart_values *data,
   if (!needheader) pout("\n");
 }
 
+// Print SMART related SCT capabilities
+static void ataPrintSCTCapability(const ata_identify_device *drive)
+{
+  unsigned short sctcaps = drive->words088_255[206-88];
+  if (!(sctcaps & 0x01))
+    return;
+  pout("SCT capabilities: \t       (0x%04x)\tSCT Status supported.\n", sctcaps);
+  if (sctcaps & 0x10)
+    pout("\t\t\t\t\tSCT Feature Control supported.\n");
+  if (sctcaps & 0x20)
+    pout("\t\t\t\t\tSCT Data Table supported.\n");
+}
+
+
 void ataPrintGeneralSmartValues(struct ata_smart_values *data, struct ata_identify_device *drive){
   pout("General SMART Values:\n");
   
@@ -912,7 +948,9 @@ void ataPrintGeneralSmartValues(struct ata_smart_values *data, struct ata_identi
   }
   if (isSupportConveyanceSelfTest(data))
     PrintSmartConveyanceSelfTestPollingTime (data);
-  
+
+  ataPrintSCTCapability(drive);
+
   pout("\n");
 }
 
@@ -1358,6 +1396,144 @@ void ataPseudoCheckSmart ( struct ata_smart_values *data,
 }
 
 
+// Format SCT Temperature value
+static const char * sct_ptemp(signed char x, char * buf)
+{
+  if (x == -128 /*0x80 = unknown*/)
+    strcpy(buf, " ?");
+  else
+    sprintf(buf, "%2d", x);
+  return buf;
+}
+
+static const char * sct_pbar(int x, char * buf)
+{
+  if (x <= 19)
+    x = 0;
+  else
+    x -= 19;
+  bool ov = false;
+  if (x > 40) {
+    x = 40; ov = true;
+  }
+  if (x > 0) {
+    memset(buf, '*', x);
+    if (ov)
+      buf[x-1] = '+';
+    buf[x] = 0;
+  }
+  else {
+    buf[0] = '-'; buf[1] = 0;
+  }
+  return buf;
+}
+
+static const char * sct_device_state_msg(unsigned char state)
+{
+  switch (state) {
+    case 0: return "Active";
+    case 1: return "Stand-by";
+    case 2: return "Sleep";
+    case 3: return "DST executing in background";
+    case 4: return "SMART Off-line Data Collection executing in background";
+    case 5: return "SCT command executing in background";
+    default:return "Unknown";
+  }
+}
+
+// Print SCT Status
+static int ataPrintSCTStatus(const ata_sct_status_response * sts)
+{
+  pout("SCT Status Version:                  %u\n", sts->format_version);
+  pout("SCT Version (vendor specific):       %u (0x%04x)\n", sts->sct_version, sts->sct_version);
+  pout("SCT Support Level:                   %u\n", sts->sct_spec);
+  pout("Device State:                        %s (%u)\n",
+    sct_device_state_msg(sts->device_state), sts->device_state);
+  char buf1[20], buf2[20];
+  if (   !sts->min_temp && !sts->life_min_temp && !sts->byte205
+      && !sts->under_limit_count && !sts->over_limit_count     ) {
+    // "Reserved" fields not set, assume "old" format version 2
+    // Table 11 of T13/1701DT Revision 5
+    // Table 54 of T13/1699-D Revision 3e
+    pout("Current Temperature:                 %s Celsius\n",
+      sct_ptemp(sts->hda_temp, buf1));
+    pout("Power Cycle Max Temperature:         %s Celsius\n",
+      sct_ptemp(sts->max_temp, buf2));
+    pout("Lifetime    Max Temperature:         %s Celsius\n",
+      sct_ptemp(sts->life_max_temp, buf2));
+  }
+  else {
+    // Assume "new" format version 2 or version 3
+    // T13/e06152r0-3 (Additional SCT Temperature Statistics)
+    // Table 60 of T13/1699-D Revision 3f
+    pout("Current Temperature:                    %s Celsius\n",
+      sct_ptemp(sts->hda_temp, buf1));
+    pout("Power Cycle Min/Max Temperature:     %s/%s Celsius\n",
+      sct_ptemp(sts->min_temp, buf1), sct_ptemp(sts->max_temp, buf2));
+    pout("Lifetime    Min/Max Temperature:     %s/%s Celsius\n",
+      sct_ptemp(sts->life_min_temp, buf1), sct_ptemp(sts->life_max_temp, buf2));
+    if (sts->byte205) // e06152r0-2, removed in e06152r3
+      pout("Lifetime    Average Temperature:        %s Celsius\n",
+        sct_ptemp((signed char)sts->byte205, buf1));
+    pout("Under/Over Temperature Limit Count:  %2u/%u\n",
+      sts->under_limit_count, sts->over_limit_count);
+  }
+  return 0;
+}
+
+// Print SCT Temperature History Table
+static int ataPrintSCTTempHist(const ata_sct_temperature_history_table * tmh)
+{
+  char buf1[20], buf2[80];
+  pout("SCT Temperature History Version:     %u\n", tmh->format_version);
+  pout("Temperature Sampling Period:         %u minute%s\n",
+    tmh->sampling_period, (tmh->sampling_period==1?"":"s"));
+  pout("Temperature Logging Interval:        %u minute%s\n",
+    tmh->interval,        (tmh->interval==1?"":"s"));
+  pout("Min/Max recommended Temperature:     %s/%s Celsius\n",
+    sct_ptemp(tmh->min_op_limit, buf1), sct_ptemp(tmh->max_op_limit, buf2));
+  pout("Min/Max Temperature Limit:           %s/%s Celsius\n",
+    sct_ptemp(tmh->under_limit, buf1), sct_ptemp(tmh->over_limit, buf2));
+  pout("Temperature History Size (Index):    %u (%u)\n", tmh->cb_size, tmh->cb_index);
+  if (!(0 < tmh->cb_size && tmh->cb_size <= sizeof(tmh->cb) && tmh->cb_index < tmh->cb_size)) {
+    pout("Error invalid Temperature History Size or Index\n");
+    return 0;
+  }
+
+  // Print table
+  pout("\nIndex    Estimated Time   Temperature Celsius\n");
+  unsigned n = 0, i = (tmh->cb_index+1) % tmh->cb_size;
+  unsigned interval = (tmh->interval > 0 ? tmh->interval : 1);
+  time_t t = time(0) - (tmh->cb_size-1) * interval * 60;
+  t -= t % (interval * 60);
+  while (n < tmh->cb_size) {
+    // Find range of identical temperatures
+    unsigned n1 = n, n2 = n+1, i2 = (i+1) % tmh->cb_size;
+    while (n2 < tmh->cb_size && tmh->cb[i2] == tmh->cb[i]) {
+      n2++; i2 = (i2+1) % tmh->cb_size;
+    }
+    // Print range
+    while (n < n2) {
+      if (n == n1 || n == n2-1 || n2 <= n1+3) {
+        char date[30];
+        // TODO: Don't print times < boot time
+        strftime(date, sizeof(date), "%Y-%m-%d %H:%M", localtime(&t));
+        pout(" %3u    %s    %s  %s\n", i, date,
+          sct_ptemp(tmh->cb[i], buf1), sct_pbar(tmh->cb[i], buf2));
+      }
+      else if (n == n1+1) {
+        pout(" ...    ..(%3u skipped).    ..  %s\n",
+          n2-n1-2, sct_pbar(tmh->cb[i], buf2));
+      }
+      t += interval * 60; i = (i+1) % tmh->cb_size; n++;
+    }
+  }
+  //assert(n == tmh->cb_size && i == (tmh->cb_index+1) % tmh->cb_size);
+
+  return 0;
+}
+
+
 // Compares failure type to policy in effect, and either exits or
 // simply returns to the calling routine.
 void failuretest(int type, int returnvalue){
@@ -1643,7 +1819,8 @@ int ataPrintMain (int fd){
     pout("\n");
 
   // START OF READ-ONLY OPTIONS APART FROM -V and -i
-  if (con->checksmart || con->generalsmartvalues || con->smartvendorattrib || con->smarterrorlog || con->smartselftestlog)
+  if (   con->checksmart || con->generalsmartvalues || con->smartvendorattrib || con->smarterrorlog
+      || con->smartselftestlog || con->selectivetestlog || con->scttempsts || con->scttemphist     )
     pout("=== START OF READ SMART DATA SECTION ===\n");
   
   // Check SMART status (use previously returned value)
@@ -1816,6 +1993,60 @@ int ataPrintMain (int fd){
     }
   }
 
+  // Print SMART SCT status and temperature history table
+  if (con->scttempsts || con->scttemphist || con->scttempint) {
+    for (;;) {
+      if (!isSCTCapable(&drive)) {
+        pout("Warning: device does not support SCT Commands\n");
+        failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
+        break;
+      }
+      if (con->scttempsts || con->scttemphist) {
+        ata_sct_status_response sts;
+        ata_sct_temperature_history_table tmh;
+        if (!con->scttemphist) {
+          // Read SCT status only
+          if (ataReadSCTStatus(fd, &sts)) {
+            failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
+            break;
+          }
+        }
+        else {
+          if (!isSCTDataTableCapable(&drive)) {
+            pout("Warning: device does not support SCT Data Table command\n");
+            failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
+            break;
+          }
+          // Read SCT status and temperature history
+          if (ataReadSCTTempHist(fd, &tmh, &sts)) {
+            failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
+            break;
+          }
+        }
+        if (con->scttempsts)
+          ataPrintSCTStatus(&sts);
+        if (con->scttemphist)
+          ataPrintSCTTempHist(&tmh);
+        pout("\n");
+      }
+      if (con->scttempint) {
+        // Set new temperature logging interval
+        if (!isSCTFeatureControlCapable(&drive)) {
+          pout("Warning: device does not support SCT Feature Control command\n");
+          failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
+          break;
+        }
+        if (ataSetSCTTempInterval(fd, con->scttempint, !!con->scttempintp)) {
+          failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
+          break;
+        }
+        pout("Temperature Logging Interval set to %u minute%s (%s)\n",
+          con->scttempint, (con->scttempint==1?"":"s"), (con->scttempintp?"persistent":"volatile"));
+      }
+      break;
+    }
+  }
+
   // START OF THE TESTING SECTION OF THE CODE.  IF NO TESTING, RETURN
   if (con->testcase==-1)
     return returnval;
@@ -1861,7 +2092,7 @@ int ataPrintMain (int fd){
 
   // Now do the test.  Note ataSmartTest prints its own error/success
   // messages
-  if (ataSmartTest(fd, con->testcase, &smartval))
+  if (ataSmartTest(fd, con->testcase, &smartval, get_num_sectors(&drive)))
     failuretest(OPTIONAL_CMD, returnval|=FAILSMART);
   else {  
     // Tell user how long test will take to complete.  This is tricky
index 968cfdd03d9ec04e06356a65348acdffac80c24e..b255738b7340eed04a5f0c189d16002287e31f96 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef ATAPRINT_H_
 #define ATAPRINT_H_
 
-#define ATAPRINT_H_CVSID "$Id: ataprint.h,v 1.29 2006/09/17 10:12:51 shattered Exp $\n"
+#define ATAPRINT_H_CVSID "$Id: ataprint.h,v 1.30 2007/04/05 18:23:29 shattered Exp $\n"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -54,7 +54,7 @@ int ataPrintSmartSelfTestlog(struct ata_smart_selftestlog *, int allentries);
 void ataPseudoCheckSmart(struct ata_smart_values *, struct ata_smart_thresholds_pvt *);
 
 // Convenience function for formatting strings from ata_identify_device.
-void formatdriveidstring(char *out, const char *in, int n);
+void format_ata_string(char *out, const char *in, int n);
 
 int ataPrintMain(int fd);
 
index 3fc1c4526344301d2e77109bd539b6fd8f5ec651..5cc810fad5c447cf88ba5b28d19552c7d49c46f1 100755 (executable)
@@ -1,9 +1,9 @@
 #!/bin/sh
-# $Id: autogen.sh,v 1.13 2005/09/19 09:28:11 chrfranke Exp $
+# $Id: autogen.sh,v 1.14 2007/01/29 21:24:18 chrfranke Exp $
 #
 # Generate ./configure from config.in and Makefile.in from Makefile.am.
 # This also adds files like missing,depcomp,install-sh to the source
-# direcory. To update these files at a later date use:
+# directory. To update these files at a later date use:
 #      autoreconf -f -i -v
 
 
@@ -36,7 +36,8 @@ typep()
     return 1
 }
 
-test -x "$AUTOMAKE" || AUTOMAKE=`typep automake-1.9` || AUTOMAKE=`typep automake-1.8` || AUTOMAKE=`typep automake-1.7` || AUTOMAKE=`typep automake17` ||
+test -x "$AUTOMAKE" || AUTOMAKE=`typep automake-1.10` || AUTOMAKE=`typep automake-1.9` ||
+    AUTOMAKE=`typep automake-1.8` || AUTOMAKE=`typep automake-1.7` || AUTOMAKE=`typep automake17` ||
 {
 echo
 echo "You must have at least GNU Automake 1.7 (up to 1.9.x) installed"
@@ -70,7 +71,7 @@ case "$AUTOMAKE" in
     ver="`$AUTOMAKE --version | head -1 | sed -n 's,^.*\([12]\.[.0-9]*[-pl0-9]*\).*$,\1,p'`"
     ver="${ver:-?.?.?}"
     case "$ver" in
-      1.[78]*|1.9.[1-6]) ver= ;;
+      1.[78]*|1.9.[1-6]|1.10) ver= ;;
     esac ;;
 esac
 
diff --git a/cciss.cpp b/cciss.cpp
new file mode 100644 (file)
index 0000000..f81ab2c
--- /dev/null
+++ b/cciss.cpp
@@ -0,0 +1,237 @@
+#include <stdio.h>
+#include <string.h>
+#include <sys/types.h>
+
+#include "config.h"
+
+#if defined(linux)
+#  include <sys/ioctl.h>
+#  ifdef HAVE_LINUX_COMPILER_H
+#    include <linux/compiler.h>
+#  endif
+#  if defined(HAVE_LINUX_CCISS_IOCTL_H)
+#    include <linux/cciss_ioctl.h>
+#    define _HAVE_CCISS
+#  endif
+#  include <asm/byteorder.h>
+#  define be32toh __be32_to_cpu
+#elif defined(__FreeBSD__) && defined(HAVE_DEV_CISS_CISSIO_H)
+#  include <sys/endian.h>
+#  include <dev/ciss/cissio.h>
+#  define _HAVE_CCISS
+#endif
+
+#ifdef _HAVE_CCISS
+#include "int64.h"
+#include "scsicmds.h"
+#include "utility.h"
+
+typedef struct _ReportLUNdata_struct
+{
+  uint32_t LUNListLength;      /* always big-endian */
+  uint32_t reserved;
+  uint8_t LUN[CISS_MAX_LUN][8];
+} ReportLunData_struct;
+
+/* Structure/defines of Report Physical LUNS of drive */
+#ifndef CISS_MAX_LUN
+#define CISS_MAX_LUN        16
+#endif
+#define CISS_MAX_PHYS_LUN   1024
+#define CISS_REPORT_PHYS    0xc3
+
+#define LSCSI_DRIVER_SENSE  0x8                /* alternate CHECK CONDITION indication */
+#define SEND_IOCTL_RESP_SENSE_LEN 16    /* ioctl limitation */
+
+static int cciss_getlun(int device, int target, unsigned char *physlun, int report);
+static int cciss_sendpassthru(unsigned int cmdtype, unsigned char *CDB,
+                       unsigned int CDBlen, char *buff,
+                       unsigned int size, unsigned int LunID,
+                       unsigned char *scsi3addr, int fd);
+
+/* 
+   This is an interface that uses the cciss passthrough to talk to the SMART controller on
+   the HP system. The cciss driver provides a way to send SCSI cmds through the CCISS passthrough.
+*/
+int cciss_io_interface(int device, int target, struct scsi_cmnd_io * iop, int report)
+{
+     unsigned char pBuf[512] = {0};
+     unsigned char phylun[8] = {0};
+     int iBufLen = 512;
+     int status = -1;
+     int len = 0; // used later in the code.
+     status = cciss_getlun(device, target, phylun, report);
+     if (report > 0)
+         printf("  cciss_getlun(%d, %d) = 0x%x; scsi3addr: %02x %02x %02x %02x %02x %02x %02x %02x\n", 
+            device, target, status, 
+            phylun[0], phylun[1], phylun[2], phylun[3], phylun[4], phylun[5], phylun[6], phylun[7]);
+     if (status) {
+         return -ENXIO;      /* give up, assume no device there */
+     }
+
+     status = cciss_sendpassthru( 2, iop->cmnd, iop->cmnd_len, (char*) pBuf, iBufLen, 1, phylun, device);
+     if (0 == status)
+     {
+         if (report > 0)
+             printf("  status=0\n");
+         if (DXFER_FROM_DEVICE == iop->dxfer_dir)
+         {
+             memcpy(iop->dxferp, pBuf, iop->dxfer_len);
+             if (report > 1)
+             {
+                 int trunc = (iop->dxfer_len > 256) ? 1 : 0;
+                 printf("  Incoming data, len=%d%s:\n", (int)iop->dxfer_len,
+                      (trunc ? " [only first 256 bytes shown]" : ""));
+                 dStrHex((const char*)iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
+             }
+         }
+         return 0;
+     }
+     iop->scsi_status = status & 0x7e; /* bits 0 and 7 used to be for vendors */
+     if (LSCSI_DRIVER_SENSE == ((status >> 24) & 0xf))
+         iop->scsi_status = SCSI_STATUS_CHECK_CONDITION;
+     len = (SEND_IOCTL_RESP_SENSE_LEN < iop->max_sense_len) ?
+                SEND_IOCTL_RESP_SENSE_LEN : iop->max_sense_len;
+     if ((SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) &&
+         iop->sensep && (len > 0))
+     {
+         memcpy(iop->sensep, pBuf, len);
+         iop->resp_sense_len = iBufLen;
+         if (report > 1)
+         {
+             printf("  >>> Sense buffer, len=%d:\n", (int)len);
+             dStrHex((const char *)pBuf, len , 1);
+         }
+     }
+     if (report)
+     {
+         if (SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) {
+             printf("  status=%x: sense_key=%x asc=%x ascq=%x\n", status & 0xff,
+                  pBuf[2] & 0xf, pBuf[12], pBuf[13]);
+         }
+         else
+             printf("  status=0x%x\n", status);
+     }
+     if (iop->scsi_status > 0)
+         return 0;
+     else
+     {
+         if (report > 0)
+             printf("  ioctl status=0x%x but scsi status=0, fail with ENXIO\n", status);
+         return -ENXIO;      /* give up, assume no device there */
+     }
+} 
+
+static int cciss_sendpassthru(unsigned int cmdtype, unsigned char *CDB,
+                       unsigned int CDBlen, char *buff,
+                       unsigned int size, unsigned int LunID,
+                       unsigned char *scsi3addr, int fd)
+{
+    int err ;
+    IOCTL_Command_struct iocommand;
+
+    memset(&iocommand, 0, sizeof(iocommand));
+
+    if (cmdtype == 0) 
+    {
+        // To controller; nothing to do
+    }
+    else if (cmdtype == 1) 
+    {
+        iocommand.LUN_info.LogDev.VolId = LunID;
+        iocommand.LUN_info.LogDev.Mode = 1;
+    }
+    else if (cmdtype == 2) 
+    {
+        memcpy(&iocommand.LUN_info.LunAddrBytes,scsi3addr,8);
+        iocommand.LUN_info.LogDev.Mode = 0;
+    }
+    else 
+    {
+        fprintf(stderr, "cciss_sendpassthru: bad cmdtype\n");
+        return 1;
+    }
+
+    memcpy(&iocommand.Request.CDB[0], CDB, CDBlen);
+    iocommand.Request.CDBLen = CDBlen;
+    iocommand.Request.Type.Type = TYPE_CMD;
+    iocommand.Request.Type.Attribute = ATTR_SIMPLE;
+    iocommand.Request.Type.Direction = XFER_READ;
+    iocommand.Request.Timeout = 0;
+
+    iocommand.buf_size = size;
+    iocommand.buf = (unsigned char *)buff;
+
+    if ((err = ioctl(fd, CCISS_PASSTHRU, &iocommand))) 
+    {
+        fprintf(stderr, "CCISS ioctl error %d (fd %d CDBLen %d buf_size %d)\n",
+           fd, err, CDBlen, size);
+    }
+    return err;
+}
+
+static int cciss_getlun(int device, int target, unsigned char *physlun, int report)
+{
+    unsigned char CDB[16]= {0};
+    ReportLunData_struct *luns;
+    int reportlunsize = sizeof(*luns) + CISS_MAX_PHYS_LUN * 8;
+    int i;
+    int ret;
+
+    luns = (ReportLunData_struct *)malloc(reportlunsize);
+
+    memset(luns, 0, reportlunsize);
+
+    /* Get Physical LUN Info (for physical device) */
+    CDB[0] = CISS_REPORT_PHYS;
+    CDB[6] = (reportlunsize >> 24) & 0xFF;  /* MSB */
+    CDB[7] = (reportlunsize >> 16) & 0xFF;
+    CDB[8] = (reportlunsize >> 8) & 0xFF;
+    CDB[9] = reportlunsize & 0xFF;
+
+    if ((ret = cciss_sendpassthru(0, CDB, 12, (char *)luns, reportlunsize, 0, NULL, device)))
+    {
+        free(luns);
+        return ret;
+    }
+
+    if (report > 1)
+    {
+      unsigned int i,j;
+      unsigned char *stuff = (unsigned char *)luns;
+
+      pout("\n===== [%s] DATA START (BASE-16) =====\n", "LUN DATA");
+      for (i=0; i<(sizeof(_ReportLUNdata_struct)+15)/16; i++){
+       pout("%03d-%03d: ", 16*i, 16*(i+1)-1);
+       for (j=0; j<15; j++)
+         pout("%02x ",*stuff++);
+       pout("%02x\n",*stuff++);
+      }
+      pout("===== [%s] DATA END (%d Bytes) =====\n\n", "LUN DATA", sizeof(_ReportLUNdata_struct));
+    }
+
+#if 0
+    for (i=0; i<CISS_MAX_LUN; i++) 
+    {
+        if (luns->LUN[i][6] == target) 
+        {
+            memcpy(physlun, luns->LUN[i], 8);
+            free(luns);
+            return 0;
+        }
+    }
+#else
+    if (target >= 0 && target < (int) be32toh(luns->LUNListLength) / 8)
+    {
+       memcpy(physlun, luns->LUN[target], 8);
+       free(luns);
+       return 0;
+    }
+#endif
+
+    free(luns);
+    return 1;
+}
+#endif 
diff --git a/cciss.h b/cciss.h
new file mode 100644 (file)
index 0000000..99452be
--- /dev/null
+++ b/cciss.h
@@ -0,0 +1,9 @@
+#ifndef CCISS_H_
+#define CCISS_H_
+
+#define CCISS_H_CVSID "$Id: cciss.h,v 1.1 2007/04/01 16:49:46 shattered Exp $\n"
+
+int cciss_io_interface(int device, int target,
+                             struct scsi_cmnd_io * iop, int report);
+
+#endif /* CCISS_H_ */
diff --git a/config.guess b/config.guess
deleted file mode 100755 (executable)
index 917bbc5..0000000
+++ /dev/null
@@ -1,1463 +0,0 @@
-#! /bin/sh
-# Attempt to guess a canonical system name.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-07-08'
-
-# This file 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 Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Originally written by Per Bothner <per@bothner.com>.
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# This script attempts to guess a canonical system name similar to
-# config.sub.  If it succeeds, it prints the system name on stdout, and
-# exits with 0.  Otherwise, it exits with 1.
-#
-# The plan is that this can be called by configure scripts if you
-# don't specify an explicit build system type.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION]
-
-Output the configuration name of the system \`$me' is run on.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.guess ($timestamp)
-
-Originally written by Per Bothner.
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
-    --version | -v )
-       echo "$version" ; exit ;;
-    --help | --h* | -h )
-       echo "$usage"; exit ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )        # Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help" >&2
-       exit 1 ;;
-    * )
-       break ;;
-  esac
-done
-
-if test $# != 0; then
-  echo "$me: too many arguments$help" >&2
-  exit 1
-fi
-
-trap 'exit 1' 1 2 15
-
-# CC_FOR_BUILD -- compiler used by this script. Note that the use of a
-# compiler to aid in system detection is discouraged as it requires
-# temporary files to be created and, as you can see below, it is a
-# headache to deal with in a portable fashion.
-
-# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still
-# use `HOST_CC' if defined, but it is deprecated.
-
-# Portable tmp directory creation inspired by the Autoconf team.
-
-set_cc_for_build='
-trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ;
-trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ;
-: ${TMPDIR=/tmp} ;
- { tmp=`(umask 077 && mktemp -d -q "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } ||
- { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } ||
- { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } ||
- { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ;
-dummy=$tmp/dummy ;
-tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ;
-case $CC_FOR_BUILD,$HOST_CC,$CC in
- ,,)    echo "int x;" > $dummy.c ;
-       for c in cc gcc c89 c99 ; do
-         if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then
-            CC_FOR_BUILD="$c"; break ;
-         fi ;
-       done ;
-       if test x"$CC_FOR_BUILD" = x ; then
-         CC_FOR_BUILD=no_compiler_found ;
-       fi
-       ;;
- ,,*)   CC_FOR_BUILD=$CC ;;
- ,*,*)  CC_FOR_BUILD=$HOST_CC ;;
-esac ; set_cc_for_build= ;'
-
-# This is needed to find uname on a Pyramid OSx when run in the BSD universe.
-# (ghazi@noc.rutgers.edu 1994-08-24)
-if (test -f /.attbin/uname) >/dev/null 2>&1 ; then
-       PATH=$PATH:/.attbin ; export PATH
-fi
-
-UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown
-UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown
-UNAME_SYSTEM=`(uname -s) 2>/dev/null`  || UNAME_SYSTEM=unknown
-UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
-
-# Note: order is significant - the case branches are not exclusive.
-
-case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
-    *:NetBSD:*:*)
-       # NetBSD (nbsd) targets should (where applicable) match one or
-       # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
-       # *-*-netbsdecoff* and *-*-netbsd*.  For targets that recently
-       # switched to ELF, *-*-netbsd* would select the old
-       # object file format.  This provides both forward
-       # compatibility and a consistent mechanism for selecting the
-       # object file format.
-       #
-       # Note: NetBSD doesn't particularly care about the vendor
-       # portion of the name.  We always set it to "unknown".
-       sysctl="sysctl -n hw.machine_arch"
-       UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \
-           /usr/sbin/$sysctl 2>/dev/null || echo unknown)`
-       case "${UNAME_MACHINE_ARCH}" in
-           armeb) machine=armeb-unknown ;;
-           arm*) machine=arm-unknown ;;
-           sh3el) machine=shl-unknown ;;
-           sh3eb) machine=sh-unknown ;;
-           *) machine=${UNAME_MACHINE_ARCH}-unknown ;;
-       esac
-       # The Operating System including object format, if it has switched
-       # to ELF recently, or will in the future.
-       case "${UNAME_MACHINE_ARCH}" in
-           arm*|i386|m68k|ns32k|sh3*|sparc|vax)
-               eval $set_cc_for_build
-               if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
-                       | grep __ELF__ >/dev/null
-               then
-                   # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
-                   # Return netbsd for either.  FIX?
-                   os=netbsd
-               else
-                   os=netbsdelf
-               fi
-               ;;
-           *)
-               os=netbsd
-               ;;
-       esac
-       # The OS release
-       # Debian GNU/NetBSD machines have a different userland, and
-       # thus, need a distinct triplet. However, they do not need
-       # kernel version information, so it can be replaced with a
-       # suitable tag, in the style of linux-gnu.
-       case "${UNAME_VERSION}" in
-           Debian*)
-               release='-gnu'
-               ;;
-           *)
-               release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'`
-               ;;
-       esac
-       # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM:
-       # contains redundant information, the shorter form:
-       # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
-       echo "${machine}-${os}${release}"
-       exit ;;
-    *:OpenBSD:*:*)
-       UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
-       echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
-       exit ;;
-    *:ekkoBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE}
-       exit ;;
-    macppc:MirBSD:*:*)
-       echo powerppc-unknown-mirbsd${UNAME_RELEASE}
-       exit ;;
-    *:MirBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE}
-       exit ;;
-    alpha:OSF1:*:*)
-       case $UNAME_RELEASE in
-       *4.0)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
-               ;;
-       *5.*)
-               UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
-               ;;
-       esac
-       # According to Compaq, /usr/sbin/psrinfo has been available on
-       # OSF/1 and Tru64 systems produced since 1995.  I hope that
-       # covers most systems running today.  This code pipes the CPU
-       # types through head -n 1, so we only detect the type of CPU 0.
-       ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^  The alpha \(.*\) processor.*$/\1/p' | head -n 1`
-       case "$ALPHA_CPU_TYPE" in
-           "EV4 (21064)")
-               UNAME_MACHINE="alpha" ;;
-           "EV4.5 (21064)")
-               UNAME_MACHINE="alpha" ;;
-           "LCA4 (21066/21068)")
-               UNAME_MACHINE="alpha" ;;
-           "EV5 (21164)")
-               UNAME_MACHINE="alphaev5" ;;
-           "EV5.6 (21164A)")
-               UNAME_MACHINE="alphaev56" ;;
-           "EV5.6 (21164PC)")
-               UNAME_MACHINE="alphapca56" ;;
-           "EV5.7 (21164PC)")
-               UNAME_MACHINE="alphapca57" ;;
-           "EV6 (21264)")
-               UNAME_MACHINE="alphaev6" ;;
-           "EV6.7 (21264A)")
-               UNAME_MACHINE="alphaev67" ;;
-           "EV6.8CB (21264C)")
-               UNAME_MACHINE="alphaev68" ;;
-           "EV6.8AL (21264B)")
-               UNAME_MACHINE="alphaev68" ;;
-           "EV6.8CX (21264D)")
-               UNAME_MACHINE="alphaev68" ;;
-           "EV6.9A (21264/EV69A)")
-               UNAME_MACHINE="alphaev69" ;;
-           "EV7 (21364)")
-               UNAME_MACHINE="alphaev7" ;;
-           "EV7.9 (21364A)")
-               UNAME_MACHINE="alphaev79" ;;
-       esac
-       # A Pn.n version is a patched version.
-       # A Vn.n version is a released version.
-       # A Tn.n version is a released field test version.
-       # A Xn.n version is an unreleased experimental baselevel.
-       # 1.2 uses "1.2" for uname -r.
-       echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-       exit ;;
-    Alpha\ *:Windows_NT*:*)
-       # How do we know it's Interix rather than the generic POSIX subsystem?
-       # Should we change UNAME_MACHINE based on the output of uname instead
-       # of the specific Alpha model?
-       echo alpha-pc-interix
-       exit ;;
-    21064:Windows_NT:50:3)
-       echo alpha-dec-winnt3.5
-       exit ;;
-    Amiga*:UNIX_System_V:4.0:*)
-       echo m68k-unknown-sysv4
-       exit ;;
-    *:[Aa]miga[Oo][Ss]:*:*)
-       echo ${UNAME_MACHINE}-unknown-amigaos
-       exit ;;
-    *:[Mm]orph[Oo][Ss]:*:*)
-       echo ${UNAME_MACHINE}-unknown-morphos
-       exit ;;
-    *:OS/390:*:*)
-       echo i370-ibm-openedition
-       exit ;;
-    *:z/VM:*:*)
-       echo s390-ibm-zvmoe
-       exit ;;
-    *:OS400:*:*)
-        echo powerpc-ibm-os400
-       exit ;;
-    arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
-       echo arm-acorn-riscix${UNAME_RELEASE}
-       exit ;;
-    arm:riscos:*:*|arm:RISCOS:*:*)
-       echo arm-unknown-riscos
-       exit ;;
-    SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
-       echo hppa1.1-hitachi-hiuxmpp
-       exit ;;
-    Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*)
-       # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE.
-       if test "`(/bin/universe) 2>/dev/null`" = att ; then
-               echo pyramid-pyramid-sysv3
-       else
-               echo pyramid-pyramid-bsd
-       fi
-       exit ;;
-    NILE*:*:*:dcosx)
-       echo pyramid-pyramid-svr4
-       exit ;;
-    DRS?6000:unix:4.0:6*)
-       echo sparc-icl-nx6
-       exit ;;
-    DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*)
-       case `/usr/bin/uname -p` in
-           sparc) echo sparc-icl-nx7; exit ;;
-       esac ;;
-    sun4H:SunOS:5.*:*)
-       echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
-    sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
-       echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
-    i86pc:SunOS:5.*:*)
-       echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
-    sun4*:SunOS:6*:*)
-       # According to config.sub, this is the proper way to canonicalize
-       # SunOS6.  Hard to guess exactly what SunOS6 will be like, but
-       # it's likely to be more like Solaris than SunOS4.
-       echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
-    sun4*:SunOS:*:*)
-       case "`/usr/bin/arch -k`" in
-           Series*|S4*)
-               UNAME_RELEASE=`uname -v`
-               ;;
-       esac
-       # Japanese Language versions have a version number like `4.1.3-JL'.
-       echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'`
-       exit ;;
-    sun3*:SunOS:*:*)
-       echo m68k-sun-sunos${UNAME_RELEASE}
-       exit ;;
-    sun*:*:4.2BSD:*)
-       UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null`
-       test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3
-       case "`/bin/arch`" in
-           sun3)
-               echo m68k-sun-sunos${UNAME_RELEASE}
-               ;;
-           sun4)
-               echo sparc-sun-sunos${UNAME_RELEASE}
-               ;;
-       esac
-       exit ;;
-    aushp:SunOS:*:*)
-       echo sparc-auspex-sunos${UNAME_RELEASE}
-       exit ;;
-    # The situation for MiNT is a little confusing.  The machine name
-    # can be virtually everything (everything which is not
-    # "atarist" or "atariste" at least should have a processor
-    # > m68000).  The system name ranges from "MiNT" over "FreeMiNT"
-    # to the lowercase version "mint" (or "freemint").  Finally
-    # the system name "TOS" denotes a system which is actually not
-    # MiNT.  But MiNT is downward compatible to TOS, so this should
-    # be no problem.
-    atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-       exit ;;
-    atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
-       echo m68k-atari-mint${UNAME_RELEASE}
-        exit ;;
-    *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
-        echo m68k-atari-mint${UNAME_RELEASE}
-       exit ;;
-    milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
-        echo m68k-milan-mint${UNAME_RELEASE}
-        exit ;;
-    hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
-        echo m68k-hades-mint${UNAME_RELEASE}
-        exit ;;
-    *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
-        echo m68k-unknown-mint${UNAME_RELEASE}
-        exit ;;
-    m68k:machten:*:*)
-       echo m68k-apple-machten${UNAME_RELEASE}
-       exit ;;
-    powerpc:machten:*:*)
-       echo powerpc-apple-machten${UNAME_RELEASE}
-       exit ;;
-    RISC*:Mach:*:*)
-       echo mips-dec-mach_bsd4.3
-       exit ;;
-    RISC*:ULTRIX:*:*)
-       echo mips-dec-ultrix${UNAME_RELEASE}
-       exit ;;
-    VAX*:ULTRIX*:*:*)
-       echo vax-dec-ultrix${UNAME_RELEASE}
-       exit ;;
-    2020:CLIX:*:* | 2430:CLIX:*:*)
-       echo clipper-intergraph-clix${UNAME_RELEASE}
-       exit ;;
-    mips:*:*:UMIPS | mips:*:*:RISCos)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-#ifdef __cplusplus
-#include <stdio.h>  /* for printf() prototype */
-       int main (int argc, char *argv[]) {
-#else
-       int main (argc, argv) int argc; char *argv[]; {
-#endif
-       #if defined (host_mips) && defined (MIPSEB)
-       #if defined (SYSTYPE_SYSV)
-         printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0);
-       #endif
-       #if defined (SYSTYPE_SVR4)
-         printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0);
-       #endif
-       #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD)
-         printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0);
-       #endif
-       #endif
-         exit (-1);
-       }
-EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c &&
-         dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` &&
-         SYSTEM_NAME=`$dummy $dummyarg` &&
-           { echo "$SYSTEM_NAME"; exit; }
-       echo mips-mips-riscos${UNAME_RELEASE}
-       exit ;;
-    Motorola:PowerMAX_OS:*:*)
-       echo powerpc-motorola-powermax
-       exit ;;
-    Motorola:*:4.3:PL8-*)
-       echo powerpc-harris-powermax
-       exit ;;
-    Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*)
-       echo powerpc-harris-powermax
-       exit ;;
-    Night_Hawk:Power_UNIX:*:*)
-       echo powerpc-harris-powerunix
-       exit ;;
-    m88k:CX/UX:7*:*)
-       echo m88k-harris-cxux7
-       exit ;;
-    m88k:*:4*:R4*)
-       echo m88k-motorola-sysv4
-       exit ;;
-    m88k:*:3*:R3*)
-       echo m88k-motorola-sysv3
-       exit ;;
-    AViiON:dgux:*:*)
-        # DG/UX returns AViiON for all architectures
-        UNAME_PROCESSOR=`/usr/bin/uname -p`
-       if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
-       then
-           if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
-              [ ${TARGET_BINARY_INTERFACE}x = x ]
-           then
-               echo m88k-dg-dgux${UNAME_RELEASE}
-           else
-               echo m88k-dg-dguxbcs${UNAME_RELEASE}
-           fi
-       else
-           echo i586-dg-dgux${UNAME_RELEASE}
-       fi
-       exit ;;
-    M88*:DolphinOS:*:*)        # DolphinOS (SVR3)
-       echo m88k-dolphin-sysv3
-       exit ;;
-    M88*:*:R3*:*)
-       # Delta 88k system running SVR3
-       echo m88k-motorola-sysv3
-       exit ;;
-    XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3)
-       echo m88k-tektronix-sysv3
-       exit ;;
-    Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD)
-       echo m68k-tektronix-bsd
-       exit ;;
-    *:IRIX*:*:*)
-       echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'`
-       exit ;;
-    ????????:AIX?:[12].1:2)   # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX.
-       echo romp-ibm-aix     # uname -m gives an 8 hex-code CPU id
-       exit ;;               # Note that: echo "'`uname -s`'" gives 'AIX '
-    i*86:AIX:*:*)
-       echo i386-ibm-aix
-       exit ;;
-    ia64:AIX:*:*)
-       if [ -x /usr/bin/oslevel ] ; then
-               IBM_REV=`/usr/bin/oslevel`
-       else
-               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-       fi
-       echo ${UNAME_MACHINE}-ibm-aix${IBM_REV}
-       exit ;;
-    *:AIX:2:3)
-       if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then
-               eval $set_cc_for_build
-               sed 's/^                //' << EOF >$dummy.c
-               #include <sys/systemcfg.h>
-
-               main()
-                       {
-                       if (!__power_pc())
-                               exit(1);
-                       puts("powerpc-ibm-aix3.2.5");
-                       exit(0);
-                       }
-EOF
-               if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy`
-               then
-                       echo "$SYSTEM_NAME"
-               else
-                       echo rs6000-ibm-aix3.2.5
-               fi
-       elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then
-               echo rs6000-ibm-aix3.2.4
-       else
-               echo rs6000-ibm-aix3.2
-       fi
-       exit ;;
-    *:AIX:*:[45])
-       IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
-       if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
-               IBM_ARCH=rs6000
-       else
-               IBM_ARCH=powerpc
-       fi
-       if [ -x /usr/bin/oslevel ] ; then
-               IBM_REV=`/usr/bin/oslevel`
-       else
-               IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE}
-       fi
-       echo ${IBM_ARCH}-ibm-aix${IBM_REV}
-       exit ;;
-    *:AIX:*:*)
-       echo rs6000-ibm-aix
-       exit ;;
-    ibmrt:4.4BSD:*|romp-ibm:BSD:*)
-       echo romp-ibm-bsd4.4
-       exit ;;
-    ibmrt:*BSD:*|romp-ibm:BSD:*)            # covers RT/PC BSD and
-       echo romp-ibm-bsd${UNAME_RELEASE}   # 4.3 with uname added to
-       exit ;;                             # report: romp-ibm BSD 4.3
-    *:BOSX:*:*)
-       echo rs6000-bull-bosx
-       exit ;;
-    DPX/2?00:B.O.S.:*:*)
-       echo m68k-bull-sysv3
-       exit ;;
-    9000/[34]??:4.3bsd:1.*:*)
-       echo m68k-hp-bsd
-       exit ;;
-    hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*)
-       echo m68k-hp-bsd4.4
-       exit ;;
-    9000/[34678]??:HP-UX:*:*)
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-       case "${UNAME_MACHINE}" in
-           9000/31? )            HP_ARCH=m68000 ;;
-           9000/[34]?? )         HP_ARCH=m68k ;;
-           9000/[678][0-9][0-9])
-               if [ -x /usr/bin/getconf ]; then
-                   sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
-                    sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
-                    case "${sc_cpu_version}" in
-                      523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
-                      528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
-                      532)                      # CPU_PA_RISC2_0
-                        case "${sc_kernel_bits}" in
-                          32) HP_ARCH="hppa2.0n" ;;
-                          64) HP_ARCH="hppa2.0w" ;;
-                         '') HP_ARCH="hppa2.0" ;;   # HP-UX 10.20
-                        esac ;;
-                    esac
-               fi
-               if [ "${HP_ARCH}" = "" ]; then
-                   eval $set_cc_for_build
-                   sed 's/^              //' << EOF >$dummy.c
-
-              #define _HPUX_SOURCE
-              #include <stdlib.h>
-              #include <unistd.h>
-
-              int main ()
-              {
-              #if defined(_SC_KERNEL_BITS)
-                  long bits = sysconf(_SC_KERNEL_BITS);
-              #endif
-                  long cpu  = sysconf (_SC_CPU_VERSION);
-
-                  switch (cpu)
-               {
-               case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
-               case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
-               case CPU_PA_RISC2_0:
-              #if defined(_SC_KERNEL_BITS)
-                   switch (bits)
-                       {
-                       case 64: puts ("hppa2.0w"); break;
-                       case 32: puts ("hppa2.0n"); break;
-                       default: puts ("hppa2.0"); break;
-                       } break;
-              #else  /* !defined(_SC_KERNEL_BITS) */
-                   puts ("hppa2.0"); break;
-              #endif
-               default: puts ("hppa1.0"); break;
-               }
-                  exit (0);
-              }
-EOF
-                   (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
-                   test -z "$HP_ARCH" && HP_ARCH=hppa
-               fi ;;
-       esac
-       if [ ${HP_ARCH} = "hppa2.0w" ]
-       then
-           eval $set_cc_for_build
-
-           # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating
-           # 32-bit code.  hppa64-hp-hpux* has the same kernel and a compiler
-           # generating 64-bit code.  GNU and HP use different nomenclature:
-           #
-           # $ CC_FOR_BUILD=cc ./config.guess
-           # => hppa2.0w-hp-hpux11.23
-           # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess
-           # => hppa64-hp-hpux11.23
-
-           if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
-               grep __LP64__ >/dev/null
-           then
-               HP_ARCH="hppa2.0w"
-           else
-               HP_ARCH="hppa64"
-           fi
-       fi
-       echo ${HP_ARCH}-hp-hpux${HPUX_REV}
-       exit ;;
-    ia64:HP-UX:*:*)
-       HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'`
-       echo ia64-hp-hpux${HPUX_REV}
-       exit ;;
-    3050*:HI-UX:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #include <unistd.h>
-       int
-       main ()
-       {
-         long cpu = sysconf (_SC_CPU_VERSION);
-         /* The order matters, because CPU_IS_HP_MC68K erroneously returns
-            true for CPU_PA_RISC1_0.  CPU_IS_PA_RISC returns correct
-            results, however.  */
-         if (CPU_IS_PA_RISC (cpu))
-           {
-             switch (cpu)
-               {
-                 case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break;
-                 case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break;
-                 case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break;
-                 default: puts ("hppa-hitachi-hiuxwe2"); break;
-               }
-           }
-         else if (CPU_IS_HP_MC68K (cpu))
-           puts ("m68k-hitachi-hiuxwe2");
-         else puts ("unknown-hitachi-hiuxwe2");
-         exit (0);
-       }
-EOF
-       $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` &&
-               { echo "$SYSTEM_NAME"; exit; }
-       echo unknown-hitachi-hiuxwe2
-       exit ;;
-    9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* )
-       echo hppa1.1-hp-bsd
-       exit ;;
-    9000/8??:4.3bsd:*:*)
-       echo hppa1.0-hp-bsd
-       exit ;;
-    *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*)
-       echo hppa1.0-hp-mpeix
-       exit ;;
-    hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* )
-       echo hppa1.1-hp-osf
-       exit ;;
-    hp8??:OSF1:*:*)
-       echo hppa1.0-hp-osf
-       exit ;;
-    i*86:OSF1:*:*)
-       if [ -x /usr/sbin/sysversion ] ; then
-           echo ${UNAME_MACHINE}-unknown-osf1mk
-       else
-           echo ${UNAME_MACHINE}-unknown-osf1
-       fi
-       exit ;;
-    parisc*:Lites*:*:*)
-       echo hppa1.1-hp-lites
-       exit ;;
-    C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
-       echo c1-convex-bsd
-        exit ;;
-    C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
-       if getsysinfo -f scalar_acc
-       then echo c32-convex-bsd
-       else echo c2-convex-bsd
-       fi
-        exit ;;
-    C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
-       echo c34-convex-bsd
-        exit ;;
-    C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
-       echo c38-convex-bsd
-        exit ;;
-    C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
-       echo c4-convex-bsd
-        exit ;;
-    CRAY*Y-MP:*:*:*)
-       echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
-    CRAY*[A-Z]90:*:*:*)
-       echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \
-       | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \
-             -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \
-             -e 's/\.[^.]*$/.X/'
-       exit ;;
-    CRAY*TS:*:*:*)
-       echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
-    CRAY*T3E:*:*:*)
-       echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
-    CRAY*SV1:*:*:*)
-       echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
-    *:UNICOS/mp:*:*)
-       echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
-       exit ;;
-    F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
-       FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
-        echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-        exit ;;
-    5000:UNIX_System_V:4.*:*)
-        FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
-        FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
-        echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
-       exit ;;
-    i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
-       echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
-       exit ;;
-    sparc*:BSD/OS:*:*)
-       echo sparc-unknown-bsdi${UNAME_RELEASE}
-       exit ;;
-    *:BSD/OS:*:*)
-       echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
-       exit ;;
-    *:FreeBSD:*:*)
-       echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-       exit ;;
-    i*:CYGWIN*:*)
-       echo ${UNAME_MACHINE}-pc-cygwin
-       exit ;;
-    i*:MINGW*:*)
-       echo ${UNAME_MACHINE}-pc-mingw32
-       exit ;;
-    i*:windows32*:*)
-       # uname -m includes "-pc" on this system.
-       echo ${UNAME_MACHINE}-mingw32
-       exit ;;
-    i*:PW*:*)
-       echo ${UNAME_MACHINE}-pc-pw32
-       exit ;;
-    x86:Interix*:[34]*)
-       echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//'
-       exit ;;
-    [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
-       echo i${UNAME_MACHINE}-pc-mks
-       exit ;;
-    i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
-       # How do we know it's Interix rather than the generic POSIX subsystem?
-       # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
-       # UNAME_MACHINE based on the output of uname instead of i386?
-       echo i586-pc-interix
-       exit ;;
-    i*:UWIN*:*)
-       echo ${UNAME_MACHINE}-pc-uwin
-       exit ;;
-    amd64:CYGWIN*:*:*)
-       echo x86_64-unknown-cygwin
-       exit ;;
-    p*:CYGWIN*:*)
-       echo powerpcle-unknown-cygwin
-       exit ;;
-    prep*:SunOS:5.*:*)
-       echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
-       exit ;;
-    *:GNU:*:*)
-       # the GNU system
-       echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
-       exit ;;
-    *:GNU/*:*:*)
-       # other systems with GNU libc and userland
-       echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
-       exit ;;
-    i*86:Minix:*:*)
-       echo ${UNAME_MACHINE}-pc-minix
-       exit ;;
-    arm*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    cris:Linux:*:*)
-       echo cris-axis-linux-gnu
-       exit ;;
-    crisv32:Linux:*:*)
-       echo crisv32-axis-linux-gnu
-       exit ;;
-    frv:Linux:*:*)
-       echo frv-unknown-linux-gnu
-       exit ;;
-    ia64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    m32r*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    m68*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    mips:Linux:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #undef CPU
-       #undef mips
-       #undef mipsel
-       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-       CPU=mipsel
-       #else
-       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-       CPU=mips
-       #else
-       CPU=
-       #endif
-       #endif
-EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
-       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-       ;;
-    mips64:Linux:*:*)
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #undef CPU
-       #undef mips64
-       #undef mips64el
-       #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
-       CPU=mips64el
-       #else
-       #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
-       CPU=mips64
-       #else
-       CPU=
-       #endif
-       #endif
-EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=`
-       test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
-       ;;
-    ppc:Linux:*:*)
-       echo powerpc-unknown-linux-gnu
-       exit ;;
-    ppc64:Linux:*:*)
-       echo powerpc64-unknown-linux-gnu
-       exit ;;
-    alpha:Linux:*:*)
-       case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
-         EV5)   UNAME_MACHINE=alphaev5 ;;
-         EV56)  UNAME_MACHINE=alphaev56 ;;
-         PCA56) UNAME_MACHINE=alphapca56 ;;
-         PCA57) UNAME_MACHINE=alphapca56 ;;
-         EV6)   UNAME_MACHINE=alphaev6 ;;
-         EV67)  UNAME_MACHINE=alphaev67 ;;
-         EV68*) UNAME_MACHINE=alphaev68 ;;
-        esac
-       objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
-       if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
-       echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC}
-       exit ;;
-    parisc:Linux:*:* | hppa:Linux:*:*)
-       # Look for CPU level
-       case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in
-         PA7*) echo hppa1.1-unknown-linux-gnu ;;
-         PA8*) echo hppa2.0-unknown-linux-gnu ;;
-         *)    echo hppa-unknown-linux-gnu ;;
-       esac
-       exit ;;
-    parisc64:Linux:*:* | hppa64:Linux:*:*)
-       echo hppa64-unknown-linux-gnu
-       exit ;;
-    s390:Linux:*:* | s390x:Linux:*:*)
-       echo ${UNAME_MACHINE}-ibm-linux
-       exit ;;
-    sh64*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    sh*:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    sparc:Linux:*:* | sparc64:Linux:*:*)
-       echo ${UNAME_MACHINE}-unknown-linux-gnu
-       exit ;;
-    x86_64:Linux:*:*)
-       echo x86_64-unknown-linux-gnu
-       exit ;;
-    i*86:Linux:*:*)
-       # The BFD linker knows what the default object file format is, so
-       # first see if it will tell us. cd to the root directory to prevent
-       # problems with other programs or directories called `ld' in the path.
-       # Set LC_ALL=C to ensure ld outputs messages in English.
-       ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
-                        | sed -ne '/supported targets:/!d
-                                   s/[         ][      ]*/ /g
-                                   s/.*supported targets: *//
-                                   s/ .*//
-                                   p'`
-        case "$ld_supported_targets" in
-         elf32-i386)
-               TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
-               ;;
-         a.out-i386-linux)
-               echo "${UNAME_MACHINE}-pc-linux-gnuaout"
-               exit ;;
-         coff-i386)
-               echo "${UNAME_MACHINE}-pc-linux-gnucoff"
-               exit ;;
-         "")
-               # Either a pre-BFD a.out linker (linux-gnuoldld) or
-               # one that does not give us useful --help.
-               echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
-               exit ;;
-       esac
-       # Determine whether the default compiler is a.out or elf
-       eval $set_cc_for_build
-       sed 's/^        //' << EOF >$dummy.c
-       #include <features.h>
-       #ifdef __ELF__
-       # ifdef __GLIBC__
-       #  if __GLIBC__ >= 2
-       LIBC=gnu
-       #  else
-       LIBC=gnulibc1
-       #  endif
-       # else
-       LIBC=gnulibc1
-       # endif
-       #else
-       #ifdef __INTEL_COMPILER
-       LIBC=gnu
-       #else
-       LIBC=gnuaout
-       #endif
-       #endif
-       #ifdef __dietlibc__
-       LIBC=dietlibc
-       #endif
-EOF
-       eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=`
-       test x"${LIBC}" != x && {
-               echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
-               exit
-       }
-       test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
-       ;;
-    i*86:DYNIX/ptx:4*:*)
-       # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
-       # earlier versions are messed up and put the nodename in both
-       # sysname and nodename.
-       echo i386-sequent-sysv4
-       exit ;;
-    i*86:UNIX_SV:4.2MP:2.*)
-        # Unixware is an offshoot of SVR4, but it has its own version
-        # number series starting with 2...
-        # I am not positive that other SVR4 systems won't match this,
-       # I just have to hope.  -- rms.
-        # Use sysv4.2uw... so that sysv4* matches it.
-       echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
-       exit ;;
-    i*86:OS/2:*:*)
-       # If we were able to find `uname', then EMX Unix compatibility
-       # is probably installed.
-       echo ${UNAME_MACHINE}-pc-os2-emx
-       exit ;;
-    i*86:XTS-300:*:STOP)
-       echo ${UNAME_MACHINE}-unknown-stop
-       exit ;;
-    i*86:atheos:*:*)
-       echo ${UNAME_MACHINE}-unknown-atheos
-       exit ;;
-    i*86:syllable:*:*)
-       echo ${UNAME_MACHINE}-pc-syllable
-       exit ;;
-    i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
-       echo i386-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
-    i*86:*DOS:*:*)
-       echo ${UNAME_MACHINE}-pc-msdosdjgpp
-       exit ;;
-    i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*)
-       UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'`
-       if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then
-               echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL}
-       else
-               echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL}
-       fi
-       exit ;;
-    i*86:*:5:[678]*)
-       # UnixWare 7.x, OpenUNIX and OpenServer 6.
-       case `/bin/uname -X | grep "^Machine"` in
-           *486*)           UNAME_MACHINE=i486 ;;
-           *Pentium)        UNAME_MACHINE=i586 ;;
-           *Pent*|*Celeron) UNAME_MACHINE=i686 ;;
-       esac
-       echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION}
-       exit ;;
-    i*86:*:3.2:*)
-       if test -f /usr/options/cb.name; then
-               UNAME_REL=`sed -n 's/.*Version //p' </usr/options/cb.name`
-               echo ${UNAME_MACHINE}-pc-isc$UNAME_REL
-       elif /bin/uname -X 2>/dev/null >/dev/null ; then
-               UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')`
-               (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486
-               (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \
-                       && UNAME_MACHINE=i586
-               (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \
-                       && UNAME_MACHINE=i686
-               (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \
-                       && UNAME_MACHINE=i686
-               echo ${UNAME_MACHINE}-pc-sco$UNAME_REL
-       else
-               echo ${UNAME_MACHINE}-pc-sysv32
-       fi
-       exit ;;
-    pc:*:*:*)
-       # Left here for compatibility:
-        # uname -m prints for DJGPP always 'pc', but it prints nothing about
-        # the processor, so we play safe by assuming i386.
-       echo i386-pc-msdosdjgpp
-        exit ;;
-    Intel:Mach:3*:*)
-       echo i386-pc-mach3
-       exit ;;
-    paragon:*:*:*)
-       echo i860-intel-osf1
-       exit ;;
-    i860:*:4.*:*) # i860-SVR4
-       if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then
-         echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4
-       else # Add other i860-SVR4 vendors below as they are discovered.
-         echo i860-unknown-sysv${UNAME_RELEASE}  # Unknown i860-SVR4
-       fi
-       exit ;;
-    mini*:CTIX:SYS*5:*)
-       # "miniframe"
-       echo m68010-convergent-sysv
-       exit ;;
-    mc68k:UNIX:SYSTEM5:3.51m)
-       echo m68k-convergent-sysv
-       exit ;;
-    M680?0:D-NIX:5.3:*)
-       echo m68k-diab-dnix
-       exit ;;
-    M68*:*:R3V[5678]*:*)
-       test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;;
-    3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0)
-       OS_REL=''
-       test -r /etc/.relid \
-       && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
-       /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-         && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
-       /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
-         && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
-    3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
-        /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
-          && { echo i486-ncr-sysv4; exit; } ;;
-    m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
-       echo m68k-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
-    mc68030:UNIX_System_V:4.*:*)
-       echo m68k-atari-sysv4
-       exit ;;
-    TSUNAMI:LynxOS:2.*:*)
-       echo sparc-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
-    rs6000:LynxOS:2.*:*)
-       echo rs6000-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
-    PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
-       echo powerpc-unknown-lynxos${UNAME_RELEASE}
-       exit ;;
-    SM[BE]S:UNIX_SV:*:*)
-       echo mips-dde-sysv${UNAME_RELEASE}
-       exit ;;
-    RM*:ReliantUNIX-*:*:*)
-       echo mips-sni-sysv4
-       exit ;;
-    RM*:SINIX-*:*:*)
-       echo mips-sni-sysv4
-       exit ;;
-    *:SINIX-*:*:*)
-       if uname -p 2>/dev/null >/dev/null ; then
-               UNAME_MACHINE=`(uname -p) 2>/dev/null`
-               echo ${UNAME_MACHINE}-sni-sysv4
-       else
-               echo ns32k-sni-sysv
-       fi
-       exit ;;
-    PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
-                      # says <Richard.M.Bartel@ccMail.Census.GOV>
-        echo i586-unisys-sysv4
-        exit ;;
-    *:UNIX_System_V:4*:FTX*)
-       # From Gerald Hewes <hewes@openmarket.com>.
-       # How about differentiating between stratus architectures? -djm
-       echo hppa1.1-stratus-sysv4
-       exit ;;
-    *:*:*:FTX*)
-       # From seanf@swdc.stratus.com.
-       echo i860-stratus-sysv4
-       exit ;;
-    i*86:VOS:*:*)
-       # From Paul.Green@stratus.com.
-       echo ${UNAME_MACHINE}-stratus-vos
-       exit ;;
-    *:VOS:*:*)
-       # From Paul.Green@stratus.com.
-       echo hppa1.1-stratus-vos
-       exit ;;
-    mc68*:A/UX:*:*)
-       echo m68k-apple-aux${UNAME_RELEASE}
-       exit ;;
-    news*:NEWS-OS:6*:*)
-       echo mips-sony-newsos6
-       exit ;;
-    R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
-       if [ -d /usr/nec ]; then
-               echo mips-nec-sysv${UNAME_RELEASE}
-       else
-               echo mips-unknown-sysv${UNAME_RELEASE}
-       fi
-        exit ;;
-    BeBox:BeOS:*:*)    # BeOS running on hardware made by Be, PPC only.
-       echo powerpc-be-beos
-       exit ;;
-    BeMac:BeOS:*:*)    # BeOS running on Mac or Mac clone, PPC only.
-       echo powerpc-apple-beos
-       exit ;;
-    BePC:BeOS:*:*)     # BeOS running on Intel PC compatible.
-       echo i586-pc-beos
-       exit ;;
-    SX-4:SUPER-UX:*:*)
-       echo sx4-nec-superux${UNAME_RELEASE}
-       exit ;;
-    SX-5:SUPER-UX:*:*)
-       echo sx5-nec-superux${UNAME_RELEASE}
-       exit ;;
-    SX-6:SUPER-UX:*:*)
-       echo sx6-nec-superux${UNAME_RELEASE}
-       exit ;;
-    Power*:Rhapsody:*:*)
-       echo powerpc-apple-rhapsody${UNAME_RELEASE}
-       exit ;;
-    *:Rhapsody:*:*)
-       echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE}
-       exit ;;
-    *:Darwin:*:*)
-       UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
-       case $UNAME_PROCESSOR in
-           *86) UNAME_PROCESSOR=i686 ;;
-           unknown) UNAME_PROCESSOR=powerpc ;;
-       esac
-       echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
-       exit ;;
-    *:procnto*:*:* | *:QNX:[0123456789]*:*)
-       UNAME_PROCESSOR=`uname -p`
-       if test "$UNAME_PROCESSOR" = "x86"; then
-               UNAME_PROCESSOR=i386
-               UNAME_MACHINE=pc
-       fi
-       echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE}
-       exit ;;
-    *:QNX:*:4*)
-       echo i386-pc-qnx
-       exit ;;
-    NSE-?:NONSTOP_KERNEL:*:*)
-       echo nse-tandem-nsk${UNAME_RELEASE}
-       exit ;;
-    NSR-?:NONSTOP_KERNEL:*:*)
-       echo nsr-tandem-nsk${UNAME_RELEASE}
-       exit ;;
-    *:NonStop-UX:*:*)
-       echo mips-compaq-nonstopux
-       exit ;;
-    BS2000:POSIX*:*:*)
-       echo bs2000-siemens-sysv
-       exit ;;
-    DS/*:UNIX_System_V:*:*)
-       echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE}
-       exit ;;
-    *:Plan9:*:*)
-       # "uname -m" is not consistent, so use $cputype instead. 386
-       # is converted to i386 for consistency with other x86
-       # operating systems.
-       if test "$cputype" = "386"; then
-           UNAME_MACHINE=i386
-       else
-           UNAME_MACHINE="$cputype"
-       fi
-       echo ${UNAME_MACHINE}-unknown-plan9
-       exit ;;
-    *:TOPS-10:*:*)
-       echo pdp10-unknown-tops10
-       exit ;;
-    *:TENEX:*:*)
-       echo pdp10-unknown-tenex
-       exit ;;
-    KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*)
-       echo pdp10-dec-tops20
-       exit ;;
-    XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*)
-       echo pdp10-xkl-tops20
-       exit ;;
-    *:TOPS-20:*:*)
-       echo pdp10-unknown-tops20
-       exit ;;
-    *:ITS:*:*)
-       echo pdp10-unknown-its
-       exit ;;
-    SEI:*:*:SEIUX)
-        echo mips-sei-seiux${UNAME_RELEASE}
-       exit ;;
-    *:DragonFly:*:*)
-       echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
-       exit ;;
-    *:*VMS:*:*)
-       UNAME_MACHINE=`(uname -p) 2>/dev/null`
-       case "${UNAME_MACHINE}" in
-           A*) echo alpha-dec-vms ; exit ;;
-           I*) echo ia64-dec-vms ; exit ;;
-           V*) echo vax-dec-vms ; exit ;;
-       esac ;;
-    *:XENIX:*:SysV)
-       echo i386-pc-xenix
-       exit ;;
-    i*86:skyos:*:*)
-       echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//'
-       exit ;;
-esac
-
-#echo '(No uname command or uname output not recognized.)' 1>&2
-#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
-
-eval $set_cc_for_build
-cat >$dummy.c <<EOF
-#ifdef _SEQUENT_
-# include <sys/types.h>
-# include <sys/utsname.h>
-#endif
-main ()
-{
-#if defined (sony)
-#if defined (MIPSEB)
-  /* BFD wants "bsd" instead of "newsos".  Perhaps BFD should be changed,
-     I don't know....  */
-  printf ("mips-sony-bsd\n"); exit (0);
-#else
-#include <sys/param.h>
-  printf ("m68k-sony-newsos%s\n",
-#ifdef NEWSOS4
-          "4"
-#else
-         ""
-#endif
-         ); exit (0);
-#endif
-#endif
-
-#if defined (__arm) && defined (__acorn) && defined (__unix)
-  printf ("arm-acorn-riscix\n"); exit (0);
-#endif
-
-#if defined (hp300) && !defined (hpux)
-  printf ("m68k-hp-bsd\n"); exit (0);
-#endif
-
-#if defined (NeXT)
-#if !defined (__ARCHITECTURE__)
-#define __ARCHITECTURE__ "m68k"
-#endif
-  int version;
-  version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`;
-  if (version < 4)
-    printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version);
-  else
-    printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version);
-  exit (0);
-#endif
-
-#if defined (MULTIMAX) || defined (n16)
-#if defined (UMAXV)
-  printf ("ns32k-encore-sysv\n"); exit (0);
-#else
-#if defined (CMU)
-  printf ("ns32k-encore-mach\n"); exit (0);
-#else
-  printf ("ns32k-encore-bsd\n"); exit (0);
-#endif
-#endif
-#endif
-
-#if defined (__386BSD__)
-  printf ("i386-pc-bsd\n"); exit (0);
-#endif
-
-#if defined (sequent)
-#if defined (i386)
-  printf ("i386-sequent-dynix\n"); exit (0);
-#endif
-#if defined (ns32000)
-  printf ("ns32k-sequent-dynix\n"); exit (0);
-#endif
-#endif
-
-#if defined (_SEQUENT_)
-    struct utsname un;
-
-    uname(&un);
-
-    if (strncmp(un.version, "V2", 2) == 0) {
-       printf ("i386-sequent-ptx2\n"); exit (0);
-    }
-    if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */
-       printf ("i386-sequent-ptx1\n"); exit (0);
-    }
-    printf ("i386-sequent-ptx\n"); exit (0);
-
-#endif
-
-#if defined (vax)
-# if !defined (ultrix)
-#  include <sys/param.h>
-#  if defined (BSD)
-#   if BSD == 43
-      printf ("vax-dec-bsd4.3\n"); exit (0);
-#   else
-#    if BSD == 199006
-      printf ("vax-dec-bsd4.3reno\n"); exit (0);
-#    else
-      printf ("vax-dec-bsd\n"); exit (0);
-#    endif
-#   endif
-#  else
-    printf ("vax-dec-bsd\n"); exit (0);
-#  endif
-# else
-    printf ("vax-dec-ultrix\n"); exit (0);
-# endif
-#endif
-
-#if defined (alliant) && defined (i860)
-  printf ("i860-alliant-bsd\n"); exit (0);
-#endif
-
-  exit (1);
-}
-EOF
-
-$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` &&
-       { echo "$SYSTEM_NAME"; exit; }
-
-# Apollos put the system type in the environment.
-
-test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; }
-
-# Convex versions that predate uname can use getsysinfo(1)
-
-if [ -x /usr/convex/getsysinfo ]
-then
-    case `getsysinfo -f cpu_type` in
-    c1*)
-       echo c1-convex-bsd
-       exit ;;
-    c2*)
-       if getsysinfo -f scalar_acc
-       then echo c32-convex-bsd
-       else echo c2-convex-bsd
-       fi
-       exit ;;
-    c34*)
-       echo c34-convex-bsd
-       exit ;;
-    c38*)
-       echo c38-convex-bsd
-       exit ;;
-    c4*)
-       echo c4-convex-bsd
-       exit ;;
-    esac
-fi
-
-cat >&2 <<EOF
-$0: unable to guess system type
-
-This script, last modified $timestamp, has failed to recognize
-the operating system you are using. It is advised that you
-download the most up to date version of the config scripts from
-
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess
-and
-  http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub
-
-If the version you run ($0) is already up to date, please
-send the following data and any information you think might be
-pertinent to <config-patches@gnu.org> in order to provide the needed
-information to handle your system.
-
-config.guess timestamp = $timestamp
-
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null`
-
-hostinfo               = `(hostinfo) 2>/dev/null`
-/bin/universe          = `(/bin/universe) 2>/dev/null`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null`
-/bin/arch              = `(/bin/arch) 2>/dev/null`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null`
-
-UNAME_MACHINE = ${UNAME_MACHINE}
-UNAME_RELEASE = ${UNAME_RELEASE}
-UNAME_SYSTEM  = ${UNAME_SYSTEM}
-UNAME_VERSION = ${UNAME_VERSION}
-EOF
-
-exit 1
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/config.h.in b/config.h.in
deleted file mode 100644 (file)
index 62f5cee..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/* config.h.in.  Generated from configure.in by autoheader.  */
-
-/* smartmontools CVS Tag */
-#undef CONFIG_H_CVSID
-
-/* use mailx as default mailer */
-#undef DEFAULT_MAILER
-
-/* Define to 1 if you have the `ata_identify_is_cached' function in os_*.c. */
-#undef HAVE_ATA_IDENTIFY_IS_CACHED
-
-/* Define to 1 if C++ compiler supports __attribute__((packed)) */
-#undef HAVE_ATTR_PACKED
-
-/* Define to 1 if you have the <dev/ata/atavar.h> header file. */
-#undef HAVE_DEV_ATA_ATAVAR_H
-
-/* Define to 1 if you have the `getdomainname' function. */
-#undef HAVE_GETDOMAINNAME
-
-/* Define to 1 if you have the `gethostbyname' function. */
-#undef HAVE_GETHOSTBYNAME
-
-/* Define to 1 if you have the `gethostname' function. */
-#undef HAVE_GETHOSTNAME
-
-/* Define to 1 if you have the `getopt' function. */
-#undef HAVE_GETOPT
-
-/* Define to 1 if you have the <getopt.h> header file. */
-#undef HAVE_GETOPT_H
-
-/* Define to 1 if you have the `getopt_long' function. */
-#undef HAVE_GETOPT_LONG
-
-/* Define to 1 if you have the `get_os_version_str' function in os_*.c. */
-#undef HAVE_GET_OS_VERSION_STR
-
-/* Define to 1 if the system has the type `int64_t'. */
-#undef HAVE_INT64_T
-
-/* Define to 1 if you have the <inttypes.h> header file. */
-#undef HAVE_INTTYPES_H
-
-/* Define to 1 if you have the <linux/compiler.h> header file. */
-#undef HAVE_LINUX_COMPILER_H
-
-/* Define to 1 if you have the <locale.h> header file. */
-#undef HAVE_LOCALE_H
-
-/* Define to 1 if you have the <memory.h> header file. */
-#undef HAVE_MEMORY_H
-
-/* Define to 1 if you have the <netdb.h> header file. */
-#undef HAVE_NETDB_H
-
-/* Define to 1 if you have the `sigset' function. */
-#undef HAVE_SIGSET
-
-/* Define to 1 if you have the <stdint.h> header file. */
-#undef HAVE_STDINT_H
-
-/* Define to 1 if you have the <stdlib.h> header file. */
-#undef HAVE_STDLIB_H
-
-/* Define to 1 if you have the <strings.h> header file. */
-#undef HAVE_STRINGS_H
-
-/* Define to 1 if you have the <string.h> header file. */
-#undef HAVE_STRING_H
-
-/* Define to 1 if you have the `strtoull' function. */
-#undef HAVE_STRTOULL
-
-/* Define to 1 if you have the <sys/inttypes.h> header file. */
-#undef HAVE_SYS_INTTYPES_H
-
-/* Define to 1 if you have the <sys/int_types.h> header file. */
-#undef HAVE_SYS_INT_TYPES_H
-
-/* Define to 1 if you have the <sys/stat.h> header file. */
-#undef HAVE_SYS_STAT_H
-
-/* Define to 1 if you have the <sys/tweio.h> header file. */
-#undef HAVE_SYS_TWEIO_H
-
-/* Define to 1 if you have the <sys/twereg.h> header file. */
-#undef HAVE_SYS_TWEREG_H
-
-/* Define to 1 if you have the <sys/tw_osl_ioctl.h> header file. */
-#undef HAVE_SYS_TW_OSL_IOCTL_H
-
-/* Define to 1 if you have the <sys/types.h> header file. */
-#undef HAVE_SYS_TYPES_H
-
-/* Define to 1 if the system has the type `uint64_t'. */
-#undef HAVE_UINT64_T
-
-/* Define to 1 if you have the `uname' function. */
-#undef HAVE_UNAME
-
-/* Define to 1 if you have the <unistd.h> header file. */
-#undef HAVE_UNISTD_H
-
-/* Define to 1 if the `snprintf' function is sane */
-#undef HAVE_WORKING_SNPRINTF
-
-/* need assembly code os_solaris_ata.s */
-#undef NEED_SOLARIS_ATA_CODE
-
-/* Name of package */
-#undef PACKAGE
-
-/* Define to the address where bug reports for this package should be sent. */
-#undef PACKAGE_BUGREPORT
-
-/* smartmontools Home Page */
-#undef PACKAGE_HOMEPAGE
-
-/* Define to the full name of this package. */
-#undef PACKAGE_NAME
-
-/* Define to the full name and version of this package. */
-#undef PACKAGE_STRING
-
-/* Define to the one symbol short name of this package. */
-#undef PACKAGE_TARNAME
-
-/* Define to the version of this package. */
-#undef PACKAGE_VERSION
-
-/* smartmontools Build Host */
-#undef SMARTMONTOOLS_BUILD_HOST
-
-/* smartmontools Configure Arguments */
-#undef SMARTMONTOOLS_CONFIGURE_ARGS
-
-/* smartmontools Configure Date */
-#undef SMARTMONTOOLS_CONFIGURE_DATE
-
-/* smartmontools Release Date */
-#undef SMARTMONTOOLS_RELEASE_DATE
-
-/* smartmontools Release Time */
-#undef SMARTMONTOOLS_RELEASE_TIME
-
-/* Define to 1 if you have the ANSI C header files. */
-#undef STDC_HEADERS
-
-/* Version number of package */
-#undef VERSION
diff --git a/config.h.in~ b/config.h.in~
new file mode 100644 (file)
index 0000000..6bfae36
--- /dev/null
@@ -0,0 +1,148 @@
+/* config.h.in.  Generated from configure.in by autoheader.  */
+
+/* smartmontools CVS Tag */
+#undef CONFIG_H_CVSID
+
+/* use mailx as default mailer */
+#undef DEFAULT_MAILER
+
+/* Define to 1 if you have the `ata_identify_is_cached' function in os_*.c. */
+#undef HAVE_ATA_IDENTIFY_IS_CACHED
+
+/* Define to 1 if C++ compiler supports __attribute__((packed)) */
+#undef HAVE_ATTR_PACKED
+
+/* Define to 1 if you have the <dev/ata/atavar.h> header file. */
+#undef HAVE_DEV_ATA_ATAVAR_H
+
+/* Define to 1 if you have the `getdomainname' function. */
+#undef HAVE_GETDOMAINNAME
+
+/* Define to 1 if you have the `gethostbyname' function. */
+#undef HAVE_GETHOSTBYNAME
+
+/* Define to 1 if you have the `gethostname' function. */
+#undef HAVE_GETHOSTNAME
+
+/* Define to 1 if you have the `getopt' function. */
+#undef HAVE_GETOPT
+
+/* Define to 1 if you have the <getopt.h> header file. */
+#undef HAVE_GETOPT_H
+
+/* Define to 1 if you have the `getopt_long' function. */
+#undef HAVE_GETOPT_LONG
+
+/* Define to 1 if you have the `get_os_version_str' function in os_*.c. */
+#undef HAVE_GET_OS_VERSION_STR
+
+/* Define to 1 if the system has the type `int64_t'. */
+#undef HAVE_INT64_T
+
+/* Define to 1 if you have the <inttypes.h> header file. */
+#undef HAVE_INTTYPES_H
+
+/* Define to 1 if you have the <locale.h> header file. */
+#undef HAVE_LOCALE_H
+
+/* Define to 1 if you have the <memory.h> header file. */
+#undef HAVE_MEMORY_H
+
+/* Define to 1 if you have the <netdb.h> header file. */
+#undef HAVE_NETDB_H
+
+/* Define to 1 if you have the `sigset' function. */
+#undef HAVE_SIGSET
+
+/* Define to 1 if you have the <stdint.h> header file. */
+#undef HAVE_STDINT_H
+
+/* Define to 1 if you have the <stdlib.h> header file. */
+#undef HAVE_STDLIB_H
+
+/* Define to 1 if you have the <strings.h> header file. */
+#undef HAVE_STRINGS_H
+
+/* Define to 1 if you have the <string.h> header file. */
+#undef HAVE_STRING_H
+
+/* Define to 1 if you have the `strtoull' function. */
+#undef HAVE_STRTOULL
+
+/* Define to 1 if you have the <sys/inttypes.h> header file. */
+#undef HAVE_SYS_INTTYPES_H
+
+/* Define to 1 if you have the <sys/int_types.h> header file. */
+#undef HAVE_SYS_INT_TYPES_H
+
+/* Define to 1 if you have the <sys/stat.h> header file. */
+#undef HAVE_SYS_STAT_H
+
+/* Define to 1 if you have the <sys/tweio.h> header file. */
+#undef HAVE_SYS_TWEIO_H
+
+/* Define to 1 if you have the <sys/twereg.h> header file. */
+#undef HAVE_SYS_TWEREG_H
+
+/* Define to 1 if you have the <sys/tw_osl_ioctl.h> header file. */
+#undef HAVE_SYS_TW_OSL_IOCTL_H
+
+/* Define to 1 if you have the <sys/types.h> header file. */
+#undef HAVE_SYS_TYPES_H
+
+/* Define to 1 if the system has the type `uint64_t'. */
+#undef HAVE_UINT64_T
+
+/* Define to 1 if you have the `uname' function. */
+#undef HAVE_UNAME
+
+/* Define to 1 if you have the <unistd.h> header file. */
+#undef HAVE_UNISTD_H
+
+/* Define to 1 if the `snprintf' function is sane */
+#undef HAVE_WORKING_SNPRINTF
+
+/* need assembly code os_solaris_ata.s */
+#undef NEED_SOLARIS_ATA_CODE
+
+/* Name of package */
+#undef PACKAGE
+
+/* Define to the address where bug reports for this package should be sent. */
+#undef PACKAGE_BUGREPORT
+
+/* smartmontools Home Page */
+#undef PACKAGE_HOMEPAGE
+
+/* Define to the full name of this package. */
+#undef PACKAGE_NAME
+
+/* Define to the full name and version of this package. */
+#undef PACKAGE_STRING
+
+/* Define to the one symbol short name of this package. */
+#undef PACKAGE_TARNAME
+
+/* Define to the version of this package. */
+#undef PACKAGE_VERSION
+
+/* smartmontools Build Host */
+#undef SMARTMONTOOLS_BUILD_HOST
+
+/* smartmontools Configure Arguments */
+#undef SMARTMONTOOLS_CONFIGURE_ARGS
+
+/* smartmontools Configure Date */
+#undef SMARTMONTOOLS_CONFIGURE_DATE
+
+/* smartmontools Release Date */
+#undef SMARTMONTOOLS_RELEASE_DATE
+
+/* smartmontools Release Time */
+#undef SMARTMONTOOLS_RELEASE_TIME
+
+/* Define to 1 if you have the ANSI C header files. */
+#undef STDC_HEADERS
+
+/* Version number of package */
+#undef VERSION
diff --git a/config.sub b/config.sub
deleted file mode 100755 (executable)
index 1c366df..0000000
+++ /dev/null
@@ -1,1579 +0,0 @@
-#! /bin/sh
-# Configuration validation subroutine script.
-#   Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
-#   2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-timestamp='2005-07-08'
-
-# This file is (in principle) common to ALL GNU software.
-# The presence of a machine in this file suggests that SOME GNU software
-# can handle that machine.  It does not imply ALL GNU software can.
-#
-# This file 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 Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
-# 02110-1301, USA.
-#
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-
-# Please send patches to <config-patches@gnu.org>.  Submit a context
-# diff and a properly formatted ChangeLog entry.
-#
-# Configuration subroutine to validate and canonicalize a configuration type.
-# Supply the specified configuration type as an argument.
-# If it is invalid, we print an error message on stderr and exit with code 1.
-# Otherwise, we print the canonical config type on stdout and succeed.
-
-# This file is supposed to be the same for all GNU packages
-# and recognize all the CPU types, system types and aliases
-# that are meaningful with *any* GNU software.
-# Each package is responsible for reporting which valid configurations
-# it does not support.  The user should be able to distinguish
-# a failure to support a valid configuration from a meaningless
-# configuration.
-
-# The goal of this file is to map all the various variations of a given
-# machine specification into a single specification in the form:
-#      CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
-# or in some cases, the newer four-part form:
-#      CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
-# It is wrong to echo any other type of specification.
-
-me=`echo "$0" | sed -e 's,.*/,,'`
-
-usage="\
-Usage: $0 [OPTION] CPU-MFR-OPSYS
-       $0 [OPTION] ALIAS
-
-Canonicalize a configuration name.
-
-Operation modes:
-  -h, --help         print this help, then exit
-  -t, --time-stamp   print date of last modification, then exit
-  -v, --version      print version number, then exit
-
-Report bugs and patches to <config-patches@gnu.org>."
-
-version="\
-GNU config.sub ($timestamp)
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005
-Free Software Foundation, Inc.
-
-This is free software; see the source for copying conditions.  There is NO
-warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."
-
-help="
-Try \`$me --help' for more information."
-
-# Parse command line
-while test $# -gt 0 ; do
-  case $1 in
-    --time-stamp | --time* | -t )
-       echo "$timestamp" ; exit ;;
-    --version | -v )
-       echo "$version" ; exit ;;
-    --help | --h* | -h )
-       echo "$usage"; exit ;;
-    -- )     # Stop option processing
-       shift; break ;;
-    - )        # Use stdin as input.
-       break ;;
-    -* )
-       echo "$me: invalid option $1$help"
-       exit 1 ;;
-
-    *local*)
-       # First pass through any local machine types.
-       echo $1
-       exit ;;
-
-    * )
-       break ;;
-  esac
-done
-
-case $# in
- 0) echo "$me: missing argument$help" >&2
-    exit 1;;
- 1) ;;
- *) echo "$me: too many arguments$help" >&2
-    exit 1;;
-esac
-
-# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any).
-# Here we must recognize all the valid KERNEL-OS combinations.
-maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
-case $maybe_os in
-  nto-qnx* | linux-gnu* | linux-dietlibc | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | \
-  kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | storm-chaos* | os2-emx* | rtmk-nova*)
-    os=-$maybe_os
-    basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
-    ;;
-  *)
-    basic_machine=`echo $1 | sed 's/-[^-]*$//'`
-    if [ $basic_machine != $1 ]
-    then os=`echo $1 | sed 's/.*-/-/'`
-    else os=; fi
-    ;;
-esac
-
-### Let's recognize common machines as not being operating systems so
-### that things like config.sub decstation-3100 work.  We also
-### recognize some manufacturers as not being operating systems, so we
-### can provide default operating systems below.
-case $os in
-       -sun*os*)
-               # Prevent following clause from handling this invalid input.
-               ;;
-       -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \
-       -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \
-       -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \
-       -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-       -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-       -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
-       -apple | -axis | -knuth | -cray)
-               os=
-               basic_machine=$1
-               ;;
-       -sim | -cisco | -oki | -wec | -winbond)
-               os=
-               basic_machine=$1
-               ;;
-       -scout)
-               ;;
-       -wrs)
-               os=-vxworks
-               basic_machine=$1
-               ;;
-       -chorusos*)
-               os=-chorusos
-               basic_machine=$1
-               ;;
-       -chorusrdb)
-               os=-chorusrdb
-               basic_machine=$1
-               ;;
-       -hiux*)
-               os=-hiuxwe2
-               ;;
-       -sco5)
-               os=-sco3.2v5
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco4)
-               os=-sco3.2v4
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco3.2.[4-9]*)
-               os=`echo $os | sed -e 's/sco3.2./sco3.2v/'`
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco3.2v[4-9]*)
-               # Don't forget version if it is 3.2v4 or newer.
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -sco*)
-               os=-sco3.2v2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -udk*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -isc)
-               os=-isc2.2
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -clix*)
-               basic_machine=clipper-intergraph
-               ;;
-       -isc*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
-               ;;
-       -lynx*)
-               os=-lynxos
-               ;;
-       -ptx*)
-               basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'`
-               ;;
-       -windowsnt*)
-               os=`echo $os | sed -e 's/windowsnt/winnt/'`
-               ;;
-       -psos*)
-               os=-psos
-               ;;
-       -mint | -mint[0-9]*)
-               basic_machine=m68k-atari
-               os=-mint
-               ;;
-esac
-
-# Decode aliases for certain CPU-COMPANY combinations.
-case $basic_machine in
-       # Recognize the basic CPU types without company name.
-       # Some are omitted here because they have special meanings below.
-       1750a | 580 \
-       | a29k \
-       | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
-       | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
-       | am33_2.0 \
-       | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \
-       | bfin \
-       | c4x | clipper \
-       | d10v | d30v | dlx | dsp16xx \
-       | fr30 | frv \
-       | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
-       | i370 | i860 | i960 | ia64 \
-       | ip2k | iq2000 \
-       | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \
-       | mips | mipsbe | mipseb | mipsel | mipsle \
-       | mips16 \
-       | mips64 | mips64el \
-       | mips64vr | mips64vrel \
-       | mips64orion | mips64orionel \
-       | mips64vr4100 | mips64vr4100el \
-       | mips64vr4300 | mips64vr4300el \
-       | mips64vr5000 | mips64vr5000el \
-       | mips64vr5900 | mips64vr5900el \
-       | mipsisa32 | mipsisa32el \
-       | mipsisa32r2 | mipsisa32r2el \
-       | mipsisa64 | mipsisa64el \
-       | mipsisa64r2 | mipsisa64r2el \
-       | mipsisa64sb1 | mipsisa64sb1el \
-       | mipsisa64sr71k | mipsisa64sr71kel \
-       | mipstx39 | mipstx39el \
-       | mn10200 | mn10300 \
-       | ms1 \
-       | msp430 \
-       | ns16k | ns32k \
-       | or32 \
-       | pdp10 | pdp11 | pj | pjl \
-       | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
-       | pyramid \
-       | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
-       | sh64 | sh64le \
-       | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
-       | sparcv8 | sparcv9 | sparcv9b \
-       | strongarm \
-       | tahoe | thumb | tic4x | tic80 | tron \
-       | v850 | v850e \
-       | we32k \
-       | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \
-       | z8k)
-               basic_machine=$basic_machine-unknown
-               ;;
-       m32c)
-               basic_machine=$basic_machine-unknown
-               ;;
-       m6811 | m68hc11 | m6812 | m68hc12)
-               # Motorola 68HC11/12.
-               basic_machine=$basic_machine-unknown
-               os=-none
-               ;;
-       m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k)
-               ;;
-
-       # We use `pc' rather than `unknown'
-       # because (1) that's what they normally are, and
-       # (2) the word "unknown" tends to confuse beginning users.
-       i*86 | x86_64)
-         basic_machine=$basic_machine-pc
-         ;;
-       # Object if more than one company name word.
-       *-*-*)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-               exit 1
-               ;;
-       # Recognize the basic CPU types with company name.
-       580-* \
-       | a29k-* \
-       | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
-       | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
-       | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
-       | arm-*  | armbe-* | armle-* | armeb-* | armv*-* \
-       | avr-* \
-       | bfin-* | bs2000-* \
-       | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
-       | clipper-* | craynv-* | cydra-* \
-       | d10v-* | d30v-* | dlx-* \
-       | elxsi-* \
-       | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \
-       | h8300-* | h8500-* \
-       | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
-       | i*86-* | i860-* | i960-* | ia64-* \
-       | ip2k-* | iq2000-* \
-       | m32r-* | m32rle-* \
-       | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
-       | m88110-* | m88k-* | maxq-* | mcore-* \
-       | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
-       | mips16-* \
-       | mips64-* | mips64el-* \
-       | mips64vr-* | mips64vrel-* \
-       | mips64orion-* | mips64orionel-* \
-       | mips64vr4100-* | mips64vr4100el-* \
-       | mips64vr4300-* | mips64vr4300el-* \
-       | mips64vr5000-* | mips64vr5000el-* \
-       | mips64vr5900-* | mips64vr5900el-* \
-       | mipsisa32-* | mipsisa32el-* \
-       | mipsisa32r2-* | mipsisa32r2el-* \
-       | mipsisa64-* | mipsisa64el-* \
-       | mipsisa64r2-* | mipsisa64r2el-* \
-       | mipsisa64sb1-* | mipsisa64sb1el-* \
-       | mipsisa64sr71k-* | mipsisa64sr71kel-* \
-       | mipstx39-* | mipstx39el-* \
-       | mmix-* \
-       | ms1-* \
-       | msp430-* \
-       | none-* | np1-* | ns16k-* | ns32k-* \
-       | orion-* \
-       | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
-       | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
-       | pyramid-* \
-       | romp-* | rs6000-* \
-       | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \
-       | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
-       | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
-       | sparclite-* \
-       | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
-       | tahoe-* | thumb-* \
-       | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
-       | tron-* \
-       | v850-* | v850e-* | vax-* \
-       | we32k-* \
-       | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \
-       | xstormy16-* | xtensa-* \
-       | ymp-* \
-       | z8k-*)
-               ;;
-       m32c-*)
-               ;;
-       # Recognize the various machine names and aliases which stand
-       # for a CPU type and a company and sometimes even an OS.
-       386bsd)
-               basic_machine=i386-unknown
-               os=-bsd
-               ;;
-       3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc)
-               basic_machine=m68000-att
-               ;;
-       3b*)
-               basic_machine=we32k-att
-               ;;
-       a29khif)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       abacus)
-               basic_machine=abacus-unknown
-               ;;
-       adobe68k)
-               basic_machine=m68010-adobe
-               os=-scout
-               ;;
-       alliant | fx80)
-               basic_machine=fx80-alliant
-               ;;
-       altos | altos3068)
-               basic_machine=m68k-altos
-               ;;
-       am29k)
-               basic_machine=a29k-none
-               os=-bsd
-               ;;
-       amd64)
-               basic_machine=x86_64-pc
-               ;;
-       amd64-*)
-               basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       amdahl)
-               basic_machine=580-amdahl
-               os=-sysv
-               ;;
-       amiga | amiga-*)
-               basic_machine=m68k-unknown
-               ;;
-       amigaos | amigados)
-               basic_machine=m68k-unknown
-               os=-amigaos
-               ;;
-       amigaunix | amix)
-               basic_machine=m68k-unknown
-               os=-sysv4
-               ;;
-       apollo68)
-               basic_machine=m68k-apollo
-               os=-sysv
-               ;;
-       apollo68bsd)
-               basic_machine=m68k-apollo
-               os=-bsd
-               ;;
-       aux)
-               basic_machine=m68k-apple
-               os=-aux
-               ;;
-       balance)
-               basic_machine=ns32k-sequent
-               os=-dynix
-               ;;
-       c90)
-               basic_machine=c90-cray
-               os=-unicos
-               ;;
-       convex-c1)
-               basic_machine=c1-convex
-               os=-bsd
-               ;;
-       convex-c2)
-               basic_machine=c2-convex
-               os=-bsd
-               ;;
-       convex-c32)
-               basic_machine=c32-convex
-               os=-bsd
-               ;;
-       convex-c34)
-               basic_machine=c34-convex
-               os=-bsd
-               ;;
-       convex-c38)
-               basic_machine=c38-convex
-               os=-bsd
-               ;;
-       cray | j90)
-               basic_machine=j90-cray
-               os=-unicos
-               ;;
-       craynv)
-               basic_machine=craynv-cray
-               os=-unicosmp
-               ;;
-       cr16c)
-               basic_machine=cr16c-unknown
-               os=-elf
-               ;;
-       crds | unos)
-               basic_machine=m68k-crds
-               ;;
-       crisv32 | crisv32-* | etraxfs*)
-               basic_machine=crisv32-axis
-               ;;
-       cris | cris-* | etrax*)
-               basic_machine=cris-axis
-               ;;
-       crx)
-               basic_machine=crx-unknown
-               os=-elf
-               ;;
-       da30 | da30-*)
-               basic_machine=m68k-da30
-               ;;
-       decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn)
-               basic_machine=mips-dec
-               ;;
-       decsystem10* | dec10*)
-               basic_machine=pdp10-dec
-               os=-tops10
-               ;;
-       decsystem20* | dec20*)
-               basic_machine=pdp10-dec
-               os=-tops20
-               ;;
-       delta | 3300 | motorola-3300 | motorola-delta \
-             | 3300-motorola | delta-motorola)
-               basic_machine=m68k-motorola
-               ;;
-       delta88)
-               basic_machine=m88k-motorola
-               os=-sysv3
-               ;;
-       djgpp)
-               basic_machine=i586-pc
-               os=-msdosdjgpp
-               ;;
-       dpx20 | dpx20-*)
-               basic_machine=rs6000-bull
-               os=-bosx
-               ;;
-       dpx2* | dpx2*-bull)
-               basic_machine=m68k-bull
-               os=-sysv3
-               ;;
-       ebmon29k)
-               basic_machine=a29k-amd
-               os=-ebmon
-               ;;
-       elxsi)
-               basic_machine=elxsi-elxsi
-               os=-bsd
-               ;;
-       encore | umax | mmax)
-               basic_machine=ns32k-encore
-               ;;
-       es1800 | OSE68k | ose68k | ose | OSE)
-               basic_machine=m68k-ericsson
-               os=-ose
-               ;;
-       fx2800)
-               basic_machine=i860-alliant
-               ;;
-       genix)
-               basic_machine=ns32k-ns
-               ;;
-       gmicro)
-               basic_machine=tron-gmicro
-               os=-sysv
-               ;;
-       go32)
-               basic_machine=i386-pc
-               os=-go32
-               ;;
-       h3050r* | hiux*)
-               basic_machine=hppa1.1-hitachi
-               os=-hiuxwe2
-               ;;
-       h8300hms)
-               basic_machine=h8300-hitachi
-               os=-hms
-               ;;
-       h8300xray)
-               basic_machine=h8300-hitachi
-               os=-xray
-               ;;
-       h8500hms)
-               basic_machine=h8500-hitachi
-               os=-hms
-               ;;
-       harris)
-               basic_machine=m88k-harris
-               os=-sysv3
-               ;;
-       hp300-*)
-               basic_machine=m68k-hp
-               ;;
-       hp300bsd)
-               basic_machine=m68k-hp
-               os=-bsd
-               ;;
-       hp300hpux)
-               basic_machine=m68k-hp
-               os=-hpux
-               ;;
-       hp3k9[0-9][0-9] | hp9[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hp9k2[0-9][0-9] | hp9k31[0-9])
-               basic_machine=m68000-hp
-               ;;
-       hp9k3[2-9][0-9])
-               basic_machine=m68k-hp
-               ;;
-       hp9k6[0-9][0-9] | hp6[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hp9k7[0-79][0-9] | hp7[0-79][0-9])
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k78[0-9] | hp78[0-9])
-               # FIXME: really hppa2.0-hp
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893)
-               # FIXME: really hppa2.0-hp
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k8[0-9][13679] | hp8[0-9][13679])
-               basic_machine=hppa1.1-hp
-               ;;
-       hp9k8[0-9][0-9] | hp8[0-9][0-9])
-               basic_machine=hppa1.0-hp
-               ;;
-       hppa-next)
-               os=-nextstep3
-               ;;
-       hppaosf)
-               basic_machine=hppa1.1-hp
-               os=-osf
-               ;;
-       hppro)
-               basic_machine=hppa1.1-hp
-               os=-proelf
-               ;;
-       i370-ibm* | ibm*)
-               basic_machine=i370-ibm
-               ;;
-# I'm not sure what "Sysv32" means.  Should this be sysv3.2?
-       i*86v32)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv32
-               ;;
-       i*86v4*)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv4
-               ;;
-       i*86v)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-sysv
-               ;;
-       i*86sol2)
-               basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
-               os=-solaris2
-               ;;
-       i386mach)
-               basic_machine=i386-mach
-               os=-mach
-               ;;
-       i386-vsta | vsta)
-               basic_machine=i386-unknown
-               os=-vsta
-               ;;
-       iris | iris4d)
-               basic_machine=mips-sgi
-               case $os in
-                   -irix*)
-                       ;;
-                   *)
-                       os=-irix4
-                       ;;
-               esac
-               ;;
-       isi68 | isi)
-               basic_machine=m68k-isi
-               os=-sysv
-               ;;
-       m88k-omron*)
-               basic_machine=m88k-omron
-               ;;
-       magnum | m3230)
-               basic_machine=mips-mips
-               os=-sysv
-               ;;
-       merlin)
-               basic_machine=ns32k-utek
-               os=-sysv
-               ;;
-       mingw32)
-               basic_machine=i386-pc
-               os=-mingw32
-               ;;
-       miniframe)
-               basic_machine=m68000-convergent
-               ;;
-       *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*)
-               basic_machine=m68k-atari
-               os=-mint
-               ;;
-       mips3*-*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`
-               ;;
-       mips3*)
-               basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown
-               ;;
-       monitor)
-               basic_machine=m68k-rom68k
-               os=-coff
-               ;;
-       morphos)
-               basic_machine=powerpc-unknown
-               os=-morphos
-               ;;
-       msdos)
-               basic_machine=i386-pc
-               os=-msdos
-               ;;
-       mvs)
-               basic_machine=i370-ibm
-               os=-mvs
-               ;;
-       ncr3000)
-               basic_machine=i486-ncr
-               os=-sysv4
-               ;;
-       netbsd386)
-               basic_machine=i386-unknown
-               os=-netbsd
-               ;;
-       netwinder)
-               basic_machine=armv4l-rebel
-               os=-linux
-               ;;
-       news | news700 | news800 | news900)
-               basic_machine=m68k-sony
-               os=-newsos
-               ;;
-       news1000)
-               basic_machine=m68030-sony
-               os=-newsos
-               ;;
-       news-3600 | risc-news)
-               basic_machine=mips-sony
-               os=-newsos
-               ;;
-       necv70)
-               basic_machine=v70-nec
-               os=-sysv
-               ;;
-       next | m*-next )
-               basic_machine=m68k-next
-               case $os in
-                   -nextstep* )
-                       ;;
-                   -ns2*)
-                     os=-nextstep2
-                       ;;
-                   *)
-                     os=-nextstep3
-                       ;;
-               esac
-               ;;
-       nh3000)
-               basic_machine=m68k-harris
-               os=-cxux
-               ;;
-       nh[45]000)
-               basic_machine=m88k-harris
-               os=-cxux
-               ;;
-       nindy960)
-               basic_machine=i960-intel
-               os=-nindy
-               ;;
-       mon960)
-               basic_machine=i960-intel
-               os=-mon960
-               ;;
-       nonstopux)
-               basic_machine=mips-compaq
-               os=-nonstopux
-               ;;
-       np1)
-               basic_machine=np1-gould
-               ;;
-       nsr-tandem)
-               basic_machine=nsr-tandem
-               ;;
-       op50n-* | op60c-*)
-               basic_machine=hppa1.1-oki
-               os=-proelf
-               ;;
-       openrisc | openrisc-*)
-               basic_machine=or32-unknown
-               ;;
-       os400)
-               basic_machine=powerpc-ibm
-               os=-os400
-               ;;
-       OSE68000 | ose68000)
-               basic_machine=m68000-ericsson
-               os=-ose
-               ;;
-       os68k)
-               basic_machine=m68k-none
-               os=-os68k
-               ;;
-       pa-hitachi)
-               basic_machine=hppa1.1-hitachi
-               os=-hiuxwe2
-               ;;
-       paragon)
-               basic_machine=i860-intel
-               os=-osf
-               ;;
-       pbd)
-               basic_machine=sparc-tti
-               ;;
-       pbb)
-               basic_machine=m68k-tti
-               ;;
-       pc532 | pc532-*)
-               basic_machine=ns32k-pc532
-               ;;
-       pentium | p5 | k5 | k6 | nexgen | viac3)
-               basic_machine=i586-pc
-               ;;
-       pentiumpro | p6 | 6x86 | athlon | athlon_*)
-               basic_machine=i686-pc
-               ;;
-       pentiumii | pentium2 | pentiumiii | pentium3)
-               basic_machine=i686-pc
-               ;;
-       pentium4)
-               basic_machine=i786-pc
-               ;;
-       pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*)
-               basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentiumpro-* | p6-* | 6x86-* | athlon-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*)
-               basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pentium4-*)
-               basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       pn)
-               basic_machine=pn-gould
-               ;;
-       power)  basic_machine=power-ibm
-               ;;
-       ppc)    basic_machine=powerpc-unknown
-               ;;
-       ppc-*)  basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppcle | powerpclittle | ppc-le | powerpc-little)
-               basic_machine=powerpcle-unknown
-               ;;
-       ppcle-* | powerpclittle-*)
-               basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppc64)  basic_machine=powerpc64-unknown
-               ;;
-       ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ppc64le | powerpc64little | ppc64-le | powerpc64-little)
-               basic_machine=powerpc64le-unknown
-               ;;
-       ppc64le-* | powerpc64little-*)
-               basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'`
-               ;;
-       ps2)
-               basic_machine=i386-ibm
-               ;;
-       pw32)
-               basic_machine=i586-unknown
-               os=-pw32
-               ;;
-       rom68k)
-               basic_machine=m68k-rom68k
-               os=-coff
-               ;;
-       rm[46]00)
-               basic_machine=mips-siemens
-               ;;
-       rtpc | rtpc-*)
-               basic_machine=romp-ibm
-               ;;
-       s390 | s390-*)
-               basic_machine=s390-ibm
-               ;;
-       s390x | s390x-*)
-               basic_machine=s390x-ibm
-               ;;
-       sa29200)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       sb1)
-               basic_machine=mipsisa64sb1-unknown
-               ;;
-       sb1el)
-               basic_machine=mipsisa64sb1el-unknown
-               ;;
-       sei)
-               basic_machine=mips-sei
-               os=-seiux
-               ;;
-       sequent)
-               basic_machine=i386-sequent
-               ;;
-       sh)
-               basic_machine=sh-hitachi
-               os=-hms
-               ;;
-       sh64)
-               basic_machine=sh64-unknown
-               ;;
-       sparclite-wrs | simso-wrs)
-               basic_machine=sparclite-wrs
-               os=-vxworks
-               ;;
-       sps7)
-               basic_machine=m68k-bull
-               os=-sysv2
-               ;;
-       spur)
-               basic_machine=spur-unknown
-               ;;
-       st2000)
-               basic_machine=m68k-tandem
-               ;;
-       stratus)
-               basic_machine=i860-stratus
-               os=-sysv4
-               ;;
-       sun2)
-               basic_machine=m68000-sun
-               ;;
-       sun2os3)
-               basic_machine=m68000-sun
-               os=-sunos3
-               ;;
-       sun2os4)
-               basic_machine=m68000-sun
-               os=-sunos4
-               ;;
-       sun3os3)
-               basic_machine=m68k-sun
-               os=-sunos3
-               ;;
-       sun3os4)
-               basic_machine=m68k-sun
-               os=-sunos4
-               ;;
-       sun4os3)
-               basic_machine=sparc-sun
-               os=-sunos3
-               ;;
-       sun4os4)
-               basic_machine=sparc-sun
-               os=-sunos4
-               ;;
-       sun4sol2)
-               basic_machine=sparc-sun
-               os=-solaris2
-               ;;
-       sun3 | sun3-*)
-               basic_machine=m68k-sun
-               ;;
-       sun4)
-               basic_machine=sparc-sun
-               ;;
-       sun386 | sun386i | roadrunner)
-               basic_machine=i386-sun
-               ;;
-       sv1)
-               basic_machine=sv1-cray
-               os=-unicos
-               ;;
-       symmetry)
-               basic_machine=i386-sequent
-               os=-dynix
-               ;;
-       t3e)
-               basic_machine=alphaev5-cray
-               os=-unicos
-               ;;
-       t90)
-               basic_machine=t90-cray
-               os=-unicos
-               ;;
-       tic54x | c54x*)
-               basic_machine=tic54x-unknown
-               os=-coff
-               ;;
-       tic55x | c55x*)
-               basic_machine=tic55x-unknown
-               os=-coff
-               ;;
-       tic6x | c6x*)
-               basic_machine=tic6x-unknown
-               os=-coff
-               ;;
-       tx39)
-               basic_machine=mipstx39-unknown
-               ;;
-       tx39el)
-               basic_machine=mipstx39el-unknown
-               ;;
-       toad1)
-               basic_machine=pdp10-xkl
-               os=-tops20
-               ;;
-       tower | tower-32)
-               basic_machine=m68k-ncr
-               ;;
-       tpf)
-               basic_machine=s390x-ibm
-               os=-tpf
-               ;;
-       udi29k)
-               basic_machine=a29k-amd
-               os=-udi
-               ;;
-       ultra3)
-               basic_machine=a29k-nyu
-               os=-sym1
-               ;;
-       v810 | necv810)
-               basic_machine=v810-nec
-               os=-none
-               ;;
-       vaxv)
-               basic_machine=vax-dec
-               os=-sysv
-               ;;
-       vms)
-               basic_machine=vax-dec
-               os=-vms
-               ;;
-       vpp*|vx|vx-*)
-               basic_machine=f301-fujitsu
-               ;;
-       vxworks960)
-               basic_machine=i960-wrs
-               os=-vxworks
-               ;;
-       vxworks68)
-               basic_machine=m68k-wrs
-               os=-vxworks
-               ;;
-       vxworks29k)
-               basic_machine=a29k-wrs
-               os=-vxworks
-               ;;
-       w65*)
-               basic_machine=w65-wdc
-               os=-none
-               ;;
-       w89k-*)
-               basic_machine=hppa1.1-winbond
-               os=-proelf
-               ;;
-       xbox)
-               basic_machine=i686-pc
-               os=-mingw32
-               ;;
-       xps | xps100)
-               basic_machine=xps100-honeywell
-               ;;
-       ymp)
-               basic_machine=ymp-cray
-               os=-unicos
-               ;;
-       z8k-*-coff)
-               basic_machine=z8k-unknown
-               os=-sim
-               ;;
-       none)
-               basic_machine=none-none
-               os=-none
-               ;;
-
-# Here we handle the default manufacturer of certain CPU types.  It is in
-# some cases the only manufacturer, in others, it is the most popular.
-       w89k)
-               basic_machine=hppa1.1-winbond
-               ;;
-       op50n)
-               basic_machine=hppa1.1-oki
-               ;;
-       op60c)
-               basic_machine=hppa1.1-oki
-               ;;
-       romp)
-               basic_machine=romp-ibm
-               ;;
-       mmix)
-               basic_machine=mmix-knuth
-               ;;
-       rs6000)
-               basic_machine=rs6000-ibm
-               ;;
-       vax)
-               basic_machine=vax-dec
-               ;;
-       pdp10)
-               # there are many clones, so DEC is not a safe bet
-               basic_machine=pdp10-unknown
-               ;;
-       pdp11)
-               basic_machine=pdp11-dec
-               ;;
-       we32k)
-               basic_machine=we32k-att
-               ;;
-       sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
-               basic_machine=sh-unknown
-               ;;
-       sparc | sparcv8 | sparcv9 | sparcv9b)
-               basic_machine=sparc-sun
-               ;;
-       cydra)
-               basic_machine=cydra-cydrome
-               ;;
-       orion)
-               basic_machine=orion-highlevel
-               ;;
-       orion105)
-               basic_machine=clipper-highlevel
-               ;;
-       mac | mpw | mac-mpw)
-               basic_machine=m68k-apple
-               ;;
-       pmac | pmac-mpw)
-               basic_machine=powerpc-apple
-               ;;
-       *-unknown)
-               # Make sure to match an already-canonicalized machine name.
-               ;;
-       *)
-               echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2
-               exit 1
-               ;;
-esac
-
-# Here we canonicalize certain aliases for manufacturers.
-case $basic_machine in
-       *-digital*)
-               basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'`
-               ;;
-       *-commodore*)
-               basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'`
-               ;;
-       *)
-               ;;
-esac
-
-# Decode manufacturer-specific aliases for certain operating systems.
-
-if [ x"$os" != x"" ]
-then
-case $os in
-        # First match some system type aliases
-        # that might get confused with valid system types.
-       # -solaris* is a basic system type, with this one exception.
-       -solaris1 | -solaris1.*)
-               os=`echo $os | sed -e 's|solaris1|sunos4|'`
-               ;;
-       -solaris)
-               os=-solaris2
-               ;;
-       -svr4*)
-               os=-sysv4
-               ;;
-       -unixware*)
-               os=-sysv4.2uw
-               ;;
-       -gnu/linux*)
-               os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'`
-               ;;
-       # First accept the basic system types.
-       # The portable systems comes first.
-       # Each alternative MUST END IN A *, to match a version number.
-       # -sysv* is not here because it comes later, after sysvr4.
-       -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \
-             | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
-             | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
-             | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
-             | -aos* \
-             | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
-             | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
-             | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \
-             | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
-             | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
-             | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
-             | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
-             | -chorusos* | -chorusrdb* \
-             | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
-             | -mingw32* | -linux-gnu* | -linux-uclibc* | -uxpv* | -beos* | -mpeix* | -udk* \
-             | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
-             | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
-             | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \
-             | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
-             | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
-             | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
-             | -skyos* | -haiku*)
-       # Remember, each alternative MUST END IN *, to match a version number.
-               ;;
-       -qnx*)
-               case $basic_machine in
-                   x86-* | i*86-*)
-                       ;;
-                   *)
-                       os=-nto$os
-                       ;;
-               esac
-               ;;
-       -nto-qnx*)
-               ;;
-       -nto*)
-               os=`echo $os | sed -e 's|nto|nto-qnx|'`
-               ;;
-       -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \
-             | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \
-             | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*)
-               ;;
-       -mac*)
-               os=`echo $os | sed -e 's|mac|macos|'`
-               ;;
-       -linux-dietlibc)
-               os=-linux-dietlibc
-               ;;
-       -linux*)
-               os=`echo $os | sed -e 's|linux|linux-gnu|'`
-               ;;
-       -sunos5*)
-               os=`echo $os | sed -e 's|sunos5|solaris2|'`
-               ;;
-       -sunos6*)
-               os=`echo $os | sed -e 's|sunos6|solaris3|'`
-               ;;
-       -opened*)
-               os=-openedition
-               ;;
-        -os400*)
-               os=-os400
-               ;;
-       -wince*)
-               os=-wince
-               ;;
-       -osfrose*)
-               os=-osfrose
-               ;;
-       -osf*)
-               os=-osf
-               ;;
-       -utek*)
-               os=-bsd
-               ;;
-       -dynix*)
-               os=-bsd
-               ;;
-       -acis*)
-               os=-aos
-               ;;
-       -atheos*)
-               os=-atheos
-               ;;
-       -syllable*)
-               os=-syllable
-               ;;
-       -386bsd)
-               os=-bsd
-               ;;
-       -ctix* | -uts*)
-               os=-sysv
-               ;;
-       -nova*)
-               os=-rtmk-nova
-               ;;
-       -ns2 )
-               os=-nextstep2
-               ;;
-       -nsk*)
-               os=-nsk
-               ;;
-       # Preserve the version number of sinix5.
-       -sinix5.*)
-               os=`echo $os | sed -e 's|sinix|sysv|'`
-               ;;
-       -sinix*)
-               os=-sysv4
-               ;;
-        -tpf*)
-               os=-tpf
-               ;;
-       -triton*)
-               os=-sysv3
-               ;;
-       -oss*)
-               os=-sysv3
-               ;;
-       -svr4)
-               os=-sysv4
-               ;;
-       -svr3)
-               os=-sysv3
-               ;;
-       -sysvr4)
-               os=-sysv4
-               ;;
-       # This must come after -sysvr4.
-       -sysv*)
-               ;;
-       -ose*)
-               os=-ose
-               ;;
-       -es1800*)
-               os=-ose
-               ;;
-       -xenix)
-               os=-xenix
-               ;;
-       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-               os=-mint
-               ;;
-       -aros*)
-               os=-aros
-               ;;
-       -kaos*)
-               os=-kaos
-               ;;
-       -zvmoe)
-               os=-zvmoe
-               ;;
-       -none)
-               ;;
-       *)
-               # Get rid of the `-' at the beginning of $os.
-               os=`echo $os | sed 's/[^-]*-//'`
-               echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2
-               exit 1
-               ;;
-esac
-else
-
-# Here we handle the default operating systems that come with various machines.
-# The value should be what the vendor currently ships out the door with their
-# machine or put another way, the most popular os provided with the machine.
-
-# Note that if you're going to try to match "-MANUFACTURER" here (say,
-# "-sun"), then you have to tell the case statement up towards the top
-# that MANUFACTURER isn't an operating system.  Otherwise, code above
-# will signal an error saying that MANUFACTURER isn't an operating
-# system, and we'll never get to this point.
-
-case $basic_machine in
-       *-acorn)
-               os=-riscix1.2
-               ;;
-       arm*-rebel)
-               os=-linux
-               ;;
-       arm*-semi)
-               os=-aout
-               ;;
-    c4x-* | tic4x-*)
-        os=-coff
-        ;;
-       # This must come before the *-dec entry.
-       pdp10-*)
-               os=-tops20
-               ;;
-       pdp11-*)
-               os=-none
-               ;;
-       *-dec | vax-*)
-               os=-ultrix4.2
-               ;;
-       m68*-apollo)
-               os=-domain
-               ;;
-       i386-sun)
-               os=-sunos4.0.2
-               ;;
-       m68000-sun)
-               os=-sunos3
-               # This also exists in the configure program, but was not the
-               # default.
-               # os=-sunos4
-               ;;
-       m68*-cisco)
-               os=-aout
-               ;;
-       mips*-cisco)
-               os=-elf
-               ;;
-       mips*-*)
-               os=-elf
-               ;;
-       or32-*)
-               os=-coff
-               ;;
-       *-tti)  # must be before sparc entry or we get the wrong os.
-               os=-sysv3
-               ;;
-       sparc-* | *-sun)
-               os=-sunos4.1.1
-               ;;
-       *-be)
-               os=-beos
-               ;;
-       *-haiku)
-               os=-haiku
-               ;;
-       *-ibm)
-               os=-aix
-               ;;
-       *-knuth)
-               os=-mmixware
-               ;;
-       *-wec)
-               os=-proelf
-               ;;
-       *-winbond)
-               os=-proelf
-               ;;
-       *-oki)
-               os=-proelf
-               ;;
-       *-hp)
-               os=-hpux
-               ;;
-       *-hitachi)
-               os=-hiux
-               ;;
-       i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent)
-               os=-sysv
-               ;;
-       *-cbm)
-               os=-amigaos
-               ;;
-       *-dg)
-               os=-dgux
-               ;;
-       *-dolphin)
-               os=-sysv3
-               ;;
-       m68k-ccur)
-               os=-rtu
-               ;;
-       m88k-omron*)
-               os=-luna
-               ;;
-       *-next )
-               os=-nextstep
-               ;;
-       *-sequent)
-               os=-ptx
-               ;;
-       *-crds)
-               os=-unos
-               ;;
-       *-ns)
-               os=-genix
-               ;;
-       i370-*)
-               os=-mvs
-               ;;
-       *-next)
-               os=-nextstep3
-               ;;
-       *-gould)
-               os=-sysv
-               ;;
-       *-highlevel)
-               os=-bsd
-               ;;
-       *-encore)
-               os=-bsd
-               ;;
-       *-sgi)
-               os=-irix
-               ;;
-       *-siemens)
-               os=-sysv4
-               ;;
-       *-masscomp)
-               os=-rtu
-               ;;
-       f30[01]-fujitsu | f700-fujitsu)
-               os=-uxpv
-               ;;
-       *-rom68k)
-               os=-coff
-               ;;
-       *-*bug)
-               os=-coff
-               ;;
-       *-apple)
-               os=-macos
-               ;;
-       *-atari*)
-               os=-mint
-               ;;
-       *)
-               os=-none
-               ;;
-esac
-fi
-
-# Here we handle the case where we know the os, and the CPU type, but not the
-# manufacturer.  We pick the logical manufacturer.
-vendor=unknown
-case $basic_machine in
-       *-unknown)
-               case $os in
-                       -riscix*)
-                               vendor=acorn
-                               ;;
-                       -sunos*)
-                               vendor=sun
-                               ;;
-                       -aix*)
-                               vendor=ibm
-                               ;;
-                       -beos*)
-                               vendor=be
-                               ;;
-                       -hpux*)
-                               vendor=hp
-                               ;;
-                       -mpeix*)
-                               vendor=hp
-                               ;;
-                       -hiux*)
-                               vendor=hitachi
-                               ;;
-                       -unos*)
-                               vendor=crds
-                               ;;
-                       -dgux*)
-                               vendor=dg
-                               ;;
-                       -luna*)
-                               vendor=omron
-                               ;;
-                       -genix*)
-                               vendor=ns
-                               ;;
-                       -mvs* | -opened*)
-                               vendor=ibm
-                               ;;
-                       -os400*)
-                               vendor=ibm
-                               ;;
-                       -ptx*)
-                               vendor=sequent
-                               ;;
-                       -tpf*)
-                               vendor=ibm
-                               ;;
-                       -vxsim* | -vxworks* | -windiss*)
-                               vendor=wrs
-                               ;;
-                       -aux*)
-                               vendor=apple
-                               ;;
-                       -hms*)
-                               vendor=hitachi
-                               ;;
-                       -mpw* | -macos*)
-                               vendor=apple
-                               ;;
-                       -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*)
-                               vendor=atari
-                               ;;
-                       -vos*)
-                               vendor=stratus
-                               ;;
-               esac
-               basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"`
-               ;;
-esac
-
-echo $basic_machine$os
-exit
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "timestamp='"
-# time-stamp-format: "%:y-%02m-%02d"
-# time-stamp-end: "'"
-# End:
diff --git a/configure b/configure
deleted file mode 100755 (executable)
index 70cc44a..0000000
--- a/configure
+++ /dev/null
@@ -1,9971 +0,0 @@
-#! /bin/sh
-# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.60 for smartmontools 5.37.
-#
-# Report bugs to <smartmontools-support@lists.sourceforge.net>.
-#
-# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" ""       $as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-  fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-if test "x$CONFIG_SHELL" = x; then
-  if (eval ":") 2>/dev/null; then
-  as_have_required=yes
-else
-  as_have_required=no
-fi
-
-  if test $as_have_required = yes &&    (eval ":
-(as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=\$LINENO
-  as_lineno_2=\$LINENO
-  test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
-  test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
-") 2> /dev/null; then
-  :
-else
-  as_candidate_shells=
-    as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in /usr/bin/posix$PATH_SEPARATOR/bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  case $as_dir in
-        /*)
-          for as_base in sh bash ksh sh5; do
-            as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
-          done;;
-       esac
-done
-IFS=$as_save_IFS
-
-
-      for as_shell in $as_candidate_shells $SHELL; do
-        # Try only shells that exist, to save several forks.
-        if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
-               { ("$as_shell") 2> /dev/null <<\_ASEOF
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-:
-_ASEOF
-}; then
-  CONFIG_SHELL=$as_shell
-              as_have_required=yes
-              if { "$as_shell" 2> /dev/null <<\_ASEOF
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-:
-(as_func_return () {
-  (exit $1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = "$1" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test $exitcode = 0) || { (exit 1); exit 1; }
-
-(
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-
-_ASEOF
-}; then
-  break
-fi
-
-fi
-
-      done
-
-      if test "x$CONFIG_SHELL" != x; then
-  for as_var in BASH_ENV ENV
-        do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-        done
-        export CONFIG_SHELL
-        exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
-fi
-
-
-    if test $as_have_required = no; then
-  echo This script requires a shell more modern than all the
-      echo shells that I found on your system.  Please install a
-      echo modern shell, or manually run the script under such a
-      echo shell if you do have one.
-      { (exit 1); exit 1; }
-fi
-
-
-fi
-
-fi
-
-
-
-(eval "as_func_return () {
-  (exit \$1)
-}
-as_func_success () {
-  as_func_return 0
-}
-as_func_failure () {
-  as_func_return 1
-}
-as_func_ret_success () {
-  return 0
-}
-as_func_ret_failure () {
-  return 1
-}
-
-exitcode=0
-if as_func_success; then
-  :
-else
-  exitcode=1
-  echo as_func_success failed.
-fi
-
-if as_func_failure; then
-  exitcode=1
-  echo as_func_failure succeeded.
-fi
-
-if as_func_ret_success; then
-  :
-else
-  exitcode=1
-  echo as_func_ret_success failed.
-fi
-
-if as_func_ret_failure; then
-  exitcode=1
-  echo as_func_ret_failure succeeded.
-fi
-
-if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
-  :
-else
-  exitcode=1
-  echo positional parameters were not saved.
-fi
-
-test \$exitcode = 0") || {
-  echo No shell found that supports shell functions.
-  echo Please tell autoconf@gnu.org about your system,
-  echo including any error possibly output before this
-  echo message
-}
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-    as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-# Find out whether ``test -x'' works.  Don't use a zero-byte file, as
-# systems may use methods other than mode bits to determine executability.
-cat >conf$$.file <<_ASEOF
-#! /bin/sh
-exit 0
-_ASEOF
-chmod +x conf$$.file
-if test -x conf$$.file >/dev/null 2>&1; then
-  as_executable_p="test -x"
-else
-  as_executable_p=:
-fi
-rm -f conf$$.file
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-
-exec 7<&0 </dev/null 6>&1
-
-# Name of the host.
-# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
-# so uname gets run too.
-ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
-
-#
-# Initializations.
-#
-ac_default_prefix=/usr/local
-ac_clean_files=
-ac_config_libobj_dir=.
-LIBOBJS=
-cross_compiling=no
-subdirs=
-MFLAGS=
-MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-
-# Identity of this package.
-PACKAGE_NAME='smartmontools'
-PACKAGE_TARNAME='smartmontools'
-PACKAGE_VERSION='5.37'
-PACKAGE_STRING='smartmontools 5.37'
-PACKAGE_BUGREPORT='smartmontools-support@lists.sourceforge.net'
-
-ac_unique_file="smartctl.cpp"
-# Factoring default headers for most tests.
-ac_includes_default="\
-#include <stdio.h>
-#if HAVE_SYS_TYPES_H
-# include <sys/types.h>
-#endif
-#if HAVE_SYS_STAT_H
-# include <sys/stat.h>
-#endif
-#if STDC_HEADERS
-# include <stdlib.h>
-# include <stddef.h>
-#else
-# if HAVE_STDLIB_H
-#  include <stdlib.h>
-# endif
-#endif
-#if HAVE_STRING_H
-# if !STDC_HEADERS && HAVE_MEMORY_H
-#  include <memory.h>
-# endif
-# include <string.h>
-#endif
-#if HAVE_STRINGS_H
-# include <strings.h>
-#endif
-#if HAVE_INTTYPES_H
-# include <inttypes.h>
-#endif
-#if HAVE_STDINT_H
-# include <stdint.h>
-#endif
-#if HAVE_UNISTD_H
-# include <unistd.h>
-#endif"
-
-ac_subst_vars='SHELL
-PATH_SEPARATOR
-PACKAGE_NAME
-PACKAGE_TARNAME
-PACKAGE_VERSION
-PACKAGE_STRING
-PACKAGE_BUGREPORT
-exec_prefix
-prefix
-program_transform_name
-bindir
-sbindir
-libexecdir
-datarootdir
-datadir
-sysconfdir
-sharedstatedir
-localstatedir
-includedir
-oldincludedir
-docdir
-infodir
-htmldir
-dvidir
-pdfdir
-psdir
-libdir
-localedir
-mandir
-DEFS
-ECHO_C
-ECHO_N
-ECHO_T
-LIBS
-build_alias
-host_alias
-target_alias
-INSTALL_PROGRAM
-INSTALL_SCRIPT
-INSTALL_DATA
-CYGPATH_W
-PACKAGE
-VERSION
-ACLOCAL
-AUTOCONF
-AUTOMAKE
-AUTOHEADER
-MAKEINFO
-install_sh
-STRIP
-INSTALL_STRIP_PROGRAM
-mkdir_p
-AWK
-SET_MAKE
-am__leading_dot
-AMTAR
-am__tar
-am__untar
-MAINTAINER_MODE_TRUE
-MAINTAINER_MODE_FALSE
-MAINT
-CXX
-CXXFLAGS
-LDFLAGS
-CPPFLAGS
-ac_ct_CXX
-EXEEXT
-OBJEXT
-DEPDIR
-am__include
-am__quote
-AMDEP_TRUE
-AMDEP_FALSE
-AMDEPBACKSLASH
-CXXDEPMODE
-am__fastdepCXX_TRUE
-am__fastdepCXX_FALSE
-CC
-CFLAGS
-ac_ct_CC
-CCDEPMODE
-am__fastdepCC_TRUE
-am__fastdepCC_FALSE
-CCAS
-CCASFLAGS
-build
-build_cpu
-build_vendor
-build_os
-host
-host_cpu
-host_vendor
-host_os
-CXXCPP
-GREP
-EGREP
-libc_have_working_snprintf
-gcc_have_attr_packed
-ASFLAGS
-exampledir
-initddir
-smartd_suffix
-SMARTD_SUFFIX_TRUE
-SMARTD_SUFFIX_FALSE
-releaseversion
-smartmontools_release_date
-smartmontools_release_time
-os_deps
-os_libs
-OS_DARWIN_TRUE
-OS_DARWIN_FALSE
-OS_SOLARIS_TRUE
-OS_SOLARIS_FALSE
-OS_WIN32_MINGW_TRUE
-OS_WIN32_MINGW_FALSE
-LIBOBJS
-LTLIBOBJS'
-ac_subst_files=''
-      ac_precious_vars='build_alias
-host_alias
-target_alias
-CXX
-CXXFLAGS
-LDFLAGS
-CPPFLAGS
-CCC
-CC
-CFLAGS
-CCAS
-CCASFLAGS
-CXXCPP'
-
-
-# Initialize some variables set by options.
-ac_init_help=
-ac_init_version=false
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-cache_file=/dev/null
-exec_prefix=NONE
-no_create=
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-verbose=
-x_includes=NONE
-x_libraries=NONE
-
-# Installation directory options.
-# These are left unexpanded so users can "make install exec_prefix=/foo"
-# and all the variables that are supposed to be based on exec_prefix
-# by default will actually change.
-# Use braces instead of parens because sh, perl, etc. also accept them.
-# (The list follows the same order as the GNU Coding Standards.)
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datarootdir='${prefix}/share'
-datadir='${datarootdir}'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
-infodir='${datarootdir}/info'
-htmldir='${docdir}'
-dvidir='${docdir}'
-pdfdir='${docdir}'
-psdir='${docdir}'
-libdir='${exec_prefix}/lib'
-localedir='${datarootdir}/locale'
-mandir='${datarootdir}/man'
-
-ac_prev=
-ac_dashdash=
-for ac_option
-do
-  # If the previous option needs an argument, assign it.
-  if test -n "$ac_prev"; then
-    eval $ac_prev=\$ac_option
-    ac_prev=
-    continue
-  fi
-
-  case $ac_option in
-  *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
-  *)   ac_optarg=yes ;;
-  esac
-
-  # Accept the important Cygnus configure options, so we can diagnose typos.
-
-  case $ac_dashdash$ac_option in
-  --)
-    ac_dashdash=yes ;;
-
-  -bindir | --bindir | --bindi | --bind | --bin | --bi)
-    ac_prev=bindir ;;
-  -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
-    bindir=$ac_optarg ;;
-
-  -build | --build | --buil | --bui | --bu)
-    ac_prev=build_alias ;;
-  -build=* | --build=* | --buil=* | --bui=* | --bu=*)
-    build_alias=$ac_optarg ;;
-
-  -cache-file | --cache-file | --cache-fil | --cache-fi \
-  | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
-    ac_prev=cache_file ;;
-  -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
-  | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
-    cache_file=$ac_optarg ;;
-
-  --config-cache | -C)
-    cache_file=config.cache ;;
-
-  -datadir | --datadir | --datadi | --datad)
-    ac_prev=datadir ;;
-  -datadir=* | --datadir=* | --datadi=* | --datad=*)
-    datadir=$ac_optarg ;;
-
-  -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \
-  | --dataroo | --dataro | --datar)
-    ac_prev=datarootdir ;;
-  -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \
-  | --dataroot=* | --dataroo=* | --dataro=* | --datar=*)
-    datarootdir=$ac_optarg ;;
-
-  -disable-* | --disable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval enable_$ac_feature=no ;;
-
-  -docdir | --docdir | --docdi | --doc | --do)
-    ac_prev=docdir ;;
-  -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*)
-    docdir=$ac_optarg ;;
-
-  -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv)
-    ac_prev=dvidir ;;
-  -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*)
-    dvidir=$ac_optarg ;;
-
-  -enable-* | --enable-*)
-    ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_feature" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid feature name: $ac_feature" >&2
-   { (exit 1); exit 1; }; }
-    ac_feature=`echo $ac_feature | sed 's/-/_/g'`
-    eval enable_$ac_feature=\$ac_optarg ;;
-
-  -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
-  | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
-  | --exec | --exe | --ex)
-    ac_prev=exec_prefix ;;
-  -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
-  | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
-  | --exec=* | --exe=* | --ex=*)
-    exec_prefix=$ac_optarg ;;
-
-  -gas | --gas | --ga | --g)
-    # Obsolete; use --with-gas.
-    with_gas=yes ;;
-
-  -help | --help | --hel | --he | -h)
-    ac_init_help=long ;;
-  -help=r* | --help=r* | --hel=r* | --he=r* | -hr*)
-    ac_init_help=recursive ;;
-  -help=s* | --help=s* | --hel=s* | --he=s* | -hs*)
-    ac_init_help=short ;;
-
-  -host | --host | --hos | --ho)
-    ac_prev=host_alias ;;
-  -host=* | --host=* | --hos=* | --ho=*)
-    host_alias=$ac_optarg ;;
-
-  -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht)
-    ac_prev=htmldir ;;
-  -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \
-  | --ht=*)
-    htmldir=$ac_optarg ;;
-
-  -includedir | --includedir | --includedi | --included | --include \
-  | --includ | --inclu | --incl | --inc)
-    ac_prev=includedir ;;
-  -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
-  | --includ=* | --inclu=* | --incl=* | --inc=*)
-    includedir=$ac_optarg ;;
-
-  -infodir | --infodir | --infodi | --infod | --info | --inf)
-    ac_prev=infodir ;;
-  -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
-    infodir=$ac_optarg ;;
-
-  -libdir | --libdir | --libdi | --libd)
-    ac_prev=libdir ;;
-  -libdir=* | --libdir=* | --libdi=* | --libd=*)
-    libdir=$ac_optarg ;;
-
-  -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
-  | --libexe | --libex | --libe)
-    ac_prev=libexecdir ;;
-  -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
-  | --libexe=* | --libex=* | --libe=*)
-    libexecdir=$ac_optarg ;;
-
-  -localedir | --localedir | --localedi | --localed | --locale)
-    ac_prev=localedir ;;
-  -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*)
-    localedir=$ac_optarg ;;
-
-  -localstatedir | --localstatedir | --localstatedi | --localstated \
-  | --localstate | --localstat | --localsta | --localst | --locals)
-    ac_prev=localstatedir ;;
-  -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
-  | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*)
-    localstatedir=$ac_optarg ;;
-
-  -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
-    ac_prev=mandir ;;
-  -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
-    mandir=$ac_optarg ;;
-
-  -nfp | --nfp | --nf)
-    # Obsolete; use --without-fp.
-    with_fp=no ;;
-
-  -no-create | --no-create | --no-creat | --no-crea | --no-cre \
-  | --no-cr | --no-c | -n)
-    no_create=yes ;;
-
-  -no-recursion | --no-recursion | --no-recursio | --no-recursi \
-  | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
-    no_recursion=yes ;;
-
-  -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
-  | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
-  | --oldin | --oldi | --old | --ol | --o)
-    ac_prev=oldincludedir ;;
-  -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
-  | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
-  | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
-    oldincludedir=$ac_optarg ;;
-
-  -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
-    ac_prev=prefix ;;
-  -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
-    prefix=$ac_optarg ;;
-
-  -program-prefix | --program-prefix | --program-prefi | --program-pref \
-  | --program-pre | --program-pr | --program-p)
-    ac_prev=program_prefix ;;
-  -program-prefix=* | --program-prefix=* | --program-prefi=* \
-  | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
-    program_prefix=$ac_optarg ;;
-
-  -program-suffix | --program-suffix | --program-suffi | --program-suff \
-  | --program-suf | --program-su | --program-s)
-    ac_prev=program_suffix ;;
-  -program-suffix=* | --program-suffix=* | --program-suffi=* \
-  | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
-    program_suffix=$ac_optarg ;;
-
-  -program-transform-name | --program-transform-name \
-  | --program-transform-nam | --program-transform-na \
-  | --program-transform-n | --program-transform- \
-  | --program-transform | --program-transfor \
-  | --program-transfo | --program-transf \
-  | --program-trans | --program-tran \
-  | --progr-tra | --program-tr | --program-t)
-    ac_prev=program_transform_name ;;
-  -program-transform-name=* | --program-transform-name=* \
-  | --program-transform-nam=* | --program-transform-na=* \
-  | --program-transform-n=* | --program-transform-=* \
-  | --program-transform=* | --program-transfor=* \
-  | --program-transfo=* | --program-transf=* \
-  | --program-trans=* | --program-tran=* \
-  | --progr-tra=* | --program-tr=* | --program-t=*)
-    program_transform_name=$ac_optarg ;;
-
-  -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd)
-    ac_prev=pdfdir ;;
-  -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*)
-    pdfdir=$ac_optarg ;;
-
-  -psdir | --psdir | --psdi | --psd | --ps)
-    ac_prev=psdir ;;
-  -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*)
-    psdir=$ac_optarg ;;
-
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil)
-    silent=yes ;;
-
-  -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
-    ac_prev=sbindir ;;
-  -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
-  | --sbi=* | --sb=*)
-    sbindir=$ac_optarg ;;
-
-  -sharedstatedir | --sharedstatedir | --sharedstatedi \
-  | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
-  | --sharedst | --shareds | --shared | --share | --shar \
-  | --sha | --sh)
-    ac_prev=sharedstatedir ;;
-  -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
-  | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
-  | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
-  | --sha=* | --sh=*)
-    sharedstatedir=$ac_optarg ;;
-
-  -site | --site | --sit)
-    ac_prev=site ;;
-  -site=* | --site=* | --sit=*)
-    site=$ac_optarg ;;
-
-  -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
-    ac_prev=srcdir ;;
-  -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
-    srcdir=$ac_optarg ;;
-
-  -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
-  | --syscon | --sysco | --sysc | --sys | --sy)
-    ac_prev=sysconfdir ;;
-  -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
-  | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
-    sysconfdir=$ac_optarg ;;
-
-  -target | --target | --targe | --targ | --tar | --ta | --t)
-    ac_prev=target_alias ;;
-  -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
-    target_alias=$ac_optarg ;;
-
-  -v | -verbose | --verbose | --verbos | --verbo | --verb)
-    verbose=yes ;;
-
-  -version | --version | --versio | --versi | --vers | -V)
-    ac_init_version=: ;;
-
-  -with-* | --with-*)
-    ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package| sed 's/-/_/g'`
-    eval with_$ac_package=\$ac_optarg ;;
-
-  -without-* | --without-*)
-    ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_package" : ".*[^-_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid package name: $ac_package" >&2
-   { (exit 1); exit 1; }; }
-    ac_package=`echo $ac_package | sed 's/-/_/g'`
-    eval with_$ac_package=no ;;
-
-  --x)
-    # Obsolete; use --with-x.
-    with_x=yes ;;
-
-  -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
-  | --x-incl | --x-inc | --x-in | --x-i)
-    ac_prev=x_includes ;;
-  -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
-  | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
-    x_includes=$ac_optarg ;;
-
-  -x-libraries | --x-libraries | --x-librarie | --x-librari \
-  | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
-    ac_prev=x_libraries ;;
-  -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
-  | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
-    x_libraries=$ac_optarg ;;
-
-  -*) { echo "$as_me: error: unrecognized option: $ac_option
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; }
-    ;;
-
-  *=*)
-    ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
-    # Reject names that are not valid shell variable names.
-    expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
-      { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
-   { (exit 1); exit 1; }; }
-    eval $ac_envvar=\$ac_optarg
-    export $ac_envvar ;;
-
-  *)
-    # FIXME: should be removed in autoconf 3.0.
-    echo "$as_me: WARNING: you should use --build, --host, --target" >&2
-    expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
-      echo "$as_me: WARNING: invalid host type: $ac_option" >&2
-    : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
-    ;;
-
-  esac
-done
-
-if test -n "$ac_prev"; then
-  ac_option=--`echo $ac_prev | sed 's/_/-/g'`
-  { echo "$as_me: error: missing argument to $ac_option" >&2
-   { (exit 1); exit 1; }; }
-fi
-
-# Be sure to have absolute directory names.
-for ac_var in  exec_prefix prefix bindir sbindir libexecdir datarootdir \
-               datadir sysconfdir sharedstatedir localstatedir includedir \
-               oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
-               libdir localedir mandir
-do
-  eval ac_val=\$$ac_var
-  case $ac_val in
-    [\\/$]* | ?:[\\/]* )  continue;;
-    NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
-  esac
-  { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
-   { (exit 1); exit 1; }; }
-done
-
-# There might be people who depend on the old broken behavior: `$host'
-# used to hold the argument of --host etc.
-# FIXME: To remove some day.
-build=$build_alias
-host=$host_alias
-target=$target_alias
-
-# FIXME: To remove some day.
-if test "x$host_alias" != x; then
-  if test "x$build_alias" = x; then
-    cross_compiling=maybe
-    echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
-    If a cross compiler is detected then cross compile mode will be used." >&2
-  elif test "x$build_alias" != "x$host_alias"; then
-    cross_compiling=yes
-  fi
-fi
-
-ac_tool_prefix=
-test -n "$host_alias" && ac_tool_prefix=$host_alias-
-
-test "$silent" = yes && exec 6>/dev/null
-
-
-ac_pwd=`pwd` && test -n "$ac_pwd" &&
-ac_ls_di=`ls -di .` &&
-ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
-  { echo "$as_me: error: Working directory cannot be determined" >&2
-   { (exit 1); exit 1; }; }
-test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
-  { echo "$as_me: error: pwd does not report name of working directory" >&2
-   { (exit 1); exit 1; }; }
-
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
-  ac_srcdir_defaulted=yes
-  # Try the directory containing this script, then the parent directory.
-  ac_confdir=`$as_dirname -- "$0" ||
-$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$0" : 'X\(//\)[^/]' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$0" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-  srcdir=$ac_confdir
-  if test ! -r "$srcdir/$ac_unique_file"; then
-    srcdir=..
-  fi
-else
-  ac_srcdir_defaulted=no
-fi
-if test ! -r "$srcdir/$ac_unique_file"; then
-  test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
-  { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
-   { (exit 1); exit 1; }; }
-fi
-ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
-ac_abs_confdir=`(
-       cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
-   { (exit 1); exit 1; }; }
-       pwd)`
-# When building in place, set srcdir=.
-if test "$ac_abs_confdir" = "$ac_pwd"; then
-  srcdir=.
-fi
-# Remove unnecessary trailing slashes from srcdir.
-# Double slashes in file names in object file debugging info
-# mess up M-x gdb in Emacs.
-case $srcdir in
-*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;;
-esac
-for ac_var in $ac_precious_vars; do
-  eval ac_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_env_${ac_var}_value=\$${ac_var}
-  eval ac_cv_env_${ac_var}_set=\${${ac_var}+set}
-  eval ac_cv_env_${ac_var}_value=\$${ac_var}
-done
-
-#
-# Report the --help message.
-#
-if test "$ac_init_help" = "long"; then
-  # Omit some internal or obsolete options to make the list less imposing.
-  # This message is too long to be a string in the A/UX 3.1 sh.
-  cat <<_ACEOF
-\`configure' configures smartmontools 5.37 to adapt to many kinds of systems.
-
-Usage: $0 [OPTION]... [VAR=VALUE]...
-
-To assign environment variables (e.g., CC, CFLAGS...), specify them as
-VAR=VALUE.  See below for descriptions of some of the useful variables.
-
-Defaults for the options are specified in brackets.
-
-Configuration:
-  -h, --help              display this help and exit
-      --help=short        display options specific to this package
-      --help=recursive    display the short help of all the included packages
-  -V, --version           display version information and exit
-  -q, --quiet, --silent   do not print \`checking...' messages
-      --cache-file=FILE   cache test results in FILE [disabled]
-  -C, --config-cache      alias for \`--cache-file=config.cache'
-  -n, --no-create         do not create output files
-      --srcdir=DIR        find the sources in DIR [configure dir or \`..']
-
-Installation directories:
-  --prefix=PREFIX         install architecture-independent files in PREFIX
-                         [$ac_default_prefix]
-  --exec-prefix=EPREFIX   install architecture-dependent files in EPREFIX
-                         [PREFIX]
-
-By default, \`make install' will install all the files in
-\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc.  You can specify
-an installation prefix other than \`$ac_default_prefix' using \`--prefix',
-for instance \`--prefix=\$HOME'.
-
-For better control, use the options below.
-
-Fine tuning of the installation directories:
-  --bindir=DIR           user executables [EPREFIX/bin]
-  --sbindir=DIR          system admin executables [EPREFIX/sbin]
-  --libexecdir=DIR       program executables [EPREFIX/libexec]
-  --sysconfdir=DIR       read-only single-machine data [PREFIX/etc]
-  --sharedstatedir=DIR   modifiable architecture-independent data [PREFIX/com]
-  --localstatedir=DIR    modifiable single-machine data [PREFIX/var]
-  --libdir=DIR           object code libraries [EPREFIX/lib]
-  --includedir=DIR       C header files [PREFIX/include]
-  --oldincludedir=DIR    C header files for non-gcc [/usr/include]
-  --datarootdir=DIR      read-only arch.-independent data root [PREFIX/share]
-  --datadir=DIR          read-only architecture-independent data [DATAROOTDIR]
-  --infodir=DIR          info documentation [DATAROOTDIR/info]
-  --localedir=DIR        locale-dependent data [DATAROOTDIR/locale]
-  --mandir=DIR           man documentation [DATAROOTDIR/man]
-  --docdir=DIR           documentation root [DATAROOTDIR/doc/smartmontools]
-  --htmldir=DIR          html documentation [DOCDIR]
-  --dvidir=DIR           dvi documentation [DOCDIR]
-  --pdfdir=DIR           pdf documentation [DOCDIR]
-  --psdir=DIR            ps documentation [DOCDIR]
-_ACEOF
-
-  cat <<\_ACEOF
-
-Program names:
-  --program-prefix=PREFIX            prepend PREFIX to installed program names
-  --program-suffix=SUFFIX            append SUFFIX to installed program names
-  --program-transform-name=PROGRAM   run sed PROGRAM on installed program names
-
-System types:
-  --build=BUILD     configure for building on BUILD [guessed]
-  --host=HOST       cross-compile to build programs to run on HOST [BUILD]
-_ACEOF
-fi
-
-if test -n "$ac_init_help"; then
-  case $ac_init_help in
-     short | recursive ) echo "Configuration of smartmontools 5.37:";;
-   esac
-  cat <<\_ACEOF
-
-Optional Features:
-  --disable-FEATURE       do not include FEATURE (same as --enable-FEATURE=no)
-  --enable-FEATURE[=ARG]  include FEATURE [ARG=yes]
-  --enable-maintainer-mode  enable make rules and dependencies not useful
-                         (and sometimes confusing) to the casual installer
-  --disable-dependency-tracking  speeds up one-time build
-  --enable-dependency-tracking   do not reject slow dependency extractors
-  --enable-sample         Enables appending .sample to the installed smartd rc
-                          script and configuration file
-
-Optional Packages:
-  --with-PACKAGE[=ARG]    use PACKAGE [ARG=yes]
-  --without-PACKAGE       do not use PACKAGE (same as --with-PACKAGE=no)
-  --with-initscriptdir=dir
-                          Location of init scripts (default is
-                          ${sysconfdir}/rc.d/init.d)
-  --with-docdir=dir       Location of documentation (default is
-                          ${prefix}/share/doc/smartmontools-5.X)
-
-Some influential environment variables:
-  CXX         C++ compiler command
-  CXXFLAGS    C++ compiler flags
-  LDFLAGS     linker flags, e.g. -L<lib dir> if you have libraries in a
-              nonstandard directory <lib dir>
-  CPPFLAGS    C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
-              you have headers in a nonstandard directory <include dir>
-  CC          C compiler command
-  CFLAGS      C compiler flags
-  CCAS        assembler compiler command (defaults to CC)
-  CCASFLAGS   assembler compiler flags (defaults to CFLAGS)
-  CXXCPP      C++ preprocessor
-
-Use these variables to override the choices made by `configure' or to help
-it to find libraries and programs with nonstandard names/locations.
-
-Report bugs to <smartmontools-support@lists.sourceforge.net>.
-_ACEOF
-ac_status=$?
-fi
-
-if test "$ac_init_help" = "recursive"; then
-  # If there are subdirs, report their specific --help.
-  for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
-    test -d "$ac_dir" || continue
-    ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-    cd "$ac_dir" || { ac_status=$?; continue; }
-    # Check for guested configure.
-    if test -f "$ac_srcdir/configure.gnu"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure.gnu" --help=recursive
-    elif test -f "$ac_srcdir/configure"; then
-      echo &&
-      $SHELL "$ac_srcdir/configure" --help=recursive
-    else
-      echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
-    fi || ac_status=$?
-    cd "$ac_pwd" || { ac_status=$?; break; }
-  done
-fi
-
-test -n "$ac_init_help" && exit $ac_status
-if $ac_init_version; then
-  cat <<\_ACEOF
-smartmontools configure 5.37
-generated by GNU Autoconf 2.60
-
-Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
-2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
-This configure script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it.
-_ACEOF
-  exit
-fi
-cat >config.log <<_ACEOF
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-
-It was created by smartmontools $as_me 5.37, which was
-generated by GNU Autoconf 2.60.  Invocation command line was
-
-  $ $0 $@
-
-_ACEOF
-exec 5>>config.log
-{
-cat <<_ASUNAME
-## --------- ##
-## Platform. ##
-## --------- ##
-
-hostname = `(hostname || uname -n) 2>/dev/null | sed 1q`
-uname -m = `(uname -m) 2>/dev/null || echo unknown`
-uname -r = `(uname -r) 2>/dev/null || echo unknown`
-uname -s = `(uname -s) 2>/dev/null || echo unknown`
-uname -v = `(uname -v) 2>/dev/null || echo unknown`
-
-/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown`
-/bin/uname -X     = `(/bin/uname -X) 2>/dev/null     || echo unknown`
-
-/bin/arch              = `(/bin/arch) 2>/dev/null              || echo unknown`
-/usr/bin/arch -k       = `(/usr/bin/arch -k) 2>/dev/null       || echo unknown`
-/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown`
-/usr/bin/hostinfo      = `(/usr/bin/hostinfo) 2>/dev/null      || echo unknown`
-/bin/machine           = `(/bin/machine) 2>/dev/null           || echo unknown`
-/usr/bin/oslevel       = `(/usr/bin/oslevel) 2>/dev/null       || echo unknown`
-/bin/universe          = `(/bin/universe) 2>/dev/null          || echo unknown`
-
-_ASUNAME
-
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  echo "PATH: $as_dir"
-done
-IFS=$as_save_IFS
-
-} >&5
-
-cat >&5 <<_ACEOF
-
-
-## ----------- ##
-## Core tests. ##
-## ----------- ##
-
-_ACEOF
-
-
-# Keep a trace of the command line.
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Strip out --silent because we don't want to record it for future runs.
-# Also quote any args containing shell meta-characters.
-# Make two passes to allow for proper duplicate-argument suppression.
-ac_configure_args=
-ac_configure_args0=
-ac_configure_args1=
-ac_must_keep_next=false
-for ac_pass in 1 2
-do
-  for ac_arg
-  do
-    case $ac_arg in
-    -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;;
-    -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-    | -silent | --silent | --silen | --sile | --sil)
-      continue ;;
-    *\'*)
-      ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
-    esac
-    case $ac_pass in
-    1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
-    2)
-      ac_configure_args1="$ac_configure_args1 '$ac_arg'"
-      if test $ac_must_keep_next = true; then
-       ac_must_keep_next=false # Got value, back to normal.
-      else
-       case $ac_arg in
-         *=* | --config-cache | -C | -disable-* | --disable-* \
-         | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \
-         | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \
-         | -with-* | --with-* | -without-* | --without-* | --x)
-           case "$ac_configure_args0 " in
-             "$ac_configure_args1"*" '$ac_arg' "* ) continue ;;
-           esac
-           ;;
-         -* ) ac_must_keep_next=true ;;
-       esac
-      fi
-      ac_configure_args="$ac_configure_args '$ac_arg'"
-      ;;
-    esac
-  done
-done
-$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
-$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
-
-# When interrupted or exit'd, cleanup temporary files, and complete
-# config.log.  We remove comments because anyway the quotes in there
-# would cause problems or look ugly.
-# WARNING: Use '\'' to represent an apostrophe within the trap.
-# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug.
-trap 'exit_status=$?
-  # Save into config.log some information that might help in debugging.
-  {
-    echo
-
-    cat <<\_ASBOX
-## ---------------- ##
-## Cache variables. ##
-## ---------------- ##
-_ASBOX
-    echo
-    # The following way of writing the cache mishandles newlines in values,
-(
-  for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
-  (set) 2>&1 |
-    case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      sed -n \
-       "s/'\''/'\''\\\\'\'''\''/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p"
-      ;; #(
-    *)
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-)
-    echo
-
-    cat <<\_ASBOX
-## ----------------- ##
-## Output variables. ##
-## ----------------- ##
-_ASBOX
-    echo
-    for ac_var in $ac_subst_vars
-    do
-      eval ac_val=\$$ac_var
-      case $ac_val in
-      *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-      esac
-      echo "$ac_var='\''$ac_val'\''"
-    done | sort
-    echo
-
-    if test -n "$ac_subst_files"; then
-      cat <<\_ASBOX
-## ------------------- ##
-## File substitutions. ##
-## ------------------- ##
-_ASBOX
-      echo
-      for ac_var in $ac_subst_files
-      do
-       eval ac_val=\$$ac_var
-       case $ac_val in
-       *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
-       esac
-       echo "$ac_var='\''$ac_val'\''"
-      done | sort
-      echo
-    fi
-
-    if test -s confdefs.h; then
-      cat <<\_ASBOX
-## ----------- ##
-## confdefs.h. ##
-## ----------- ##
-_ASBOX
-      echo
-      cat confdefs.h
-      echo
-    fi
-    test "$ac_signal" != 0 &&
-      echo "$as_me: caught signal $ac_signal"
-    echo "$as_me: exit $exit_status"
-  } >&5
-  rm -f core *.core core.conftest.* &&
-    rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
-    exit $exit_status
-' 0
-for ac_signal in 1 2 13 15; do
-  trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
-done
-ac_signal=0
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -f -r conftest* confdefs.h
-
-# Predefined preprocessor variables.
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_NAME "$PACKAGE_NAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_VERSION "$PACKAGE_VERSION"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_STRING "$PACKAGE_STRING"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
-
-
-# Let the site file select an alternate cache file if it wants to.
-# Prefer explicitly selected file to automatically selected ones.
-if test -n "$CONFIG_SITE"; then
-  set x "$CONFIG_SITE"
-elif test "x$prefix" != xNONE; then
-  set x "$prefix/share/config.site" "$prefix/etc/config.site"
-else
-  set x "$ac_default_prefix/share/config.site" \
-       "$ac_default_prefix/etc/config.site"
-fi
-shift
-for ac_site_file
-do
-  if test -r "$ac_site_file"; then
-    { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
-echo "$as_me: loading site script $ac_site_file" >&6;}
-    sed 's/^/| /' "$ac_site_file" >&5
-    . "$ac_site_file"
-  fi
-done
-
-if test -r "$cache_file"; then
-  # Some versions of bash will fail to source /dev/null (special
-  # files actually), so we avoid doing that.
-  if test -f "$cache_file"; then
-    { echo "$as_me:$LINENO: loading cache $cache_file" >&5
-echo "$as_me: loading cache $cache_file" >&6;}
-    case $cache_file in
-      [\\/]* | ?:[\\/]* ) . "$cache_file";;
-      *)                      . "./$cache_file";;
-    esac
-  fi
-else
-  { echo "$as_me:$LINENO: creating cache $cache_file" >&5
-echo "$as_me: creating cache $cache_file" >&6;}
-  >$cache_file
-fi
-
-# Check that the precious variables saved in the cache have kept the same
-# value.
-ac_cache_corrupted=false
-for ac_var in $ac_precious_vars; do
-  eval ac_old_set=\$ac_cv_env_${ac_var}_set
-  eval ac_new_set=\$ac_env_${ac_var}_set
-  eval ac_old_val=\$ac_cv_env_${ac_var}_value
-  eval ac_new_val=\$ac_env_${ac_var}_value
-  case $ac_old_set,$ac_new_set in
-    set,)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,set)
-      { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
-echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
-      ac_cache_corrupted=: ;;
-    ,);;
-    *)
-      if test "x$ac_old_val" != "x$ac_new_val"; then
-       { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
-echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
-       { echo "$as_me:$LINENO:   former value:  $ac_old_val" >&5
-echo "$as_me:   former value:  $ac_old_val" >&2;}
-       { echo "$as_me:$LINENO:   current value: $ac_new_val" >&5
-echo "$as_me:   current value: $ac_new_val" >&2;}
-       ac_cache_corrupted=:
-      fi;;
-  esac
-  # Pass precious variables to config.status.
-  if test "$ac_new_set" = set; then
-    case $ac_new_val in
-    *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
-    *) ac_arg=$ac_var=$ac_new_val ;;
-    esac
-    case " $ac_configure_args " in
-      *" '$ac_arg' "*) ;; # Avoid dups.  Use of quotes ensures accuracy.
-      *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
-    esac
-  fi
-done
-if $ac_cache_corrupted; then
-  { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
-echo "$as_me: error: changes in the environment can compromise the build" >&2;}
-  { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
-echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-
-
-
-
-smartmontools_configure_date=`date -u +"%Y/%m/%d %T %Z"`
-smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.121 2006/10/30 12:28:54 ballen4705 Exp $'`
-smartmontools_release_date=2006/12/20
-smartmontools_release_time="20:37:59 UTC"
-
-
-cat >>confdefs.h <<_ACEOF
-#define SMARTMONTOOLS_CONFIGURE_ARGS "$ac_configure_args"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define SMARTMONTOOLS_CONFIGURE_DATE "$smartmontools_configure_date"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define SMARTMONTOOLS_RELEASE_DATE "$smartmontools_release_date"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define SMARTMONTOOLS_RELEASE_TIME "$smartmontools_release_time"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define CONFIG_H_CVSID "$smartmontools_cvs_tag"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_HOMEPAGE "http://smartmontools.sourceforge.net/"
-_ACEOF
-
-
-ac_config_headers="$ac_config_headers config.h"
-
-
-am__api_version="1.9"
-ac_aux_dir=
-for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
-  if test -f "$ac_dir/install-sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install-sh -c"
-    break
-  elif test -f "$ac_dir/install.sh"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/install.sh -c"
-    break
-  elif test -f "$ac_dir/shtool"; then
-    ac_aux_dir=$ac_dir
-    ac_install_sh="$ac_aux_dir/shtool install -c"
-    break
-  fi
-done
-if test -z "$ac_aux_dir"; then
-  { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
-echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-# These three variables are undocumented and unsupported,
-# and are intended to be withdrawn in a future Autoconf release.
-# They can cause serious problems if a builder's source tree is in a directory
-# whose full name contains unusual characters.
-ac_config_guess="$SHELL $ac_aux_dir/config.guess"  # Please don't use this var.
-ac_config_sub="$SHELL $ac_aux_dir/config.sub"  # Please don't use this var.
-ac_configure="$SHELL $ac_aux_dir/configure"  # Please don't use this var.
-
-
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then
-         if test $ac_prog = install &&
-           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-           # AIX install.  It has an incompatible calling convention.
-           :
-         elif test $ac_prog = install &&
-           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-           # program-specific install script used by HP pwplus--don't use.
-           :
-         else
-           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-           break 3
-         fi
-       fi
-      done
-    done
-    ;;
-esac
-done
-IFS=$as_save_IFS
-
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
-fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
-echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
-# Just in case
-sleep 1
-echo timestamp > conftest.file
-# Do `set' in a subshell so we don't clobber the current shell's
-# arguments.  Must try -L first in case configure is actually a
-# symlink; some systems play weird games with the mod time of symlinks
-# (eg FreeBSD returns the mod time of the symlink's containing
-# directory).
-if (
-   set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
-   if test "$*" = "X"; then
-      # -L didn't work.
-      set X `ls -t $srcdir/configure conftest.file`
-   fi
-   rm -f conftest.file
-   if test "$*" != "X $srcdir/configure conftest.file" \
-      && test "$*" != "X conftest.file $srcdir/configure"; then
-
-      # If neither matched, then we have a broken ls.  This can happen
-      # if, for instance, CONFIG_SHELL is bash and it inherits a
-      # broken ls alias from the environment.  This has actually
-      # happened.  Such a system could not be considered "sane".
-      { { echo "$as_me:$LINENO: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&5
-echo "$as_me: error: ls -t appears to fail.  Make sure there is not a broken
-alias in your environment" >&2;}
-   { (exit 1); exit 1; }; }
-   fi
-
-   test "$2" = conftest.file
-   )
-then
-   # Ok.
-   :
-else
-   { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
-Check your system clock" >&5
-echo "$as_me: error: newly created file is older than distributed files!
-Check your system clock" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-test "$program_prefix" != NONE &&
-  program_transform_name="s&^&$program_prefix&;$program_transform_name"
-# Use a double $ so make ignores it.
-test "$program_suffix" != NONE &&
-  program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.  echo might interpret backslashes.
-# By default was `s,x,x', remove it if useless.
-cat <<\_ACEOF >conftest.sed
-s/[\\$]/&&/g;s/;s,x,x,$//
-_ACEOF
-program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
-rm -f conftest.sed
-
-# expand $ac_aux_dir to an absolute path
-am_aux_dir=`cd $ac_aux_dir && pwd`
-
-test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
-# Use eval to expand $SHELL
-if eval "$MISSING --run true"; then
-  am_missing_run="$MISSING --run "
-else
-  am_missing_run=
-  { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
-echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
-fi
-
-if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
-  # We used to keeping the `.' as first argument, in order to
-  # allow $(mkdir_p) to be used without argument.  As in
-  #   $(mkdir_p) $(somedir)
-  # where $(somedir) is conditionally defined.  However this is wrong
-  # for two reasons:
-  #  1. if the package is installed by a user who cannot write `.'
-  #     make install will fail,
-  #  2. the above comment should most certainly read
-  #     $(mkdir_p) $(DESTDIR)$(somedir)
-  #     so it does not work when $(somedir) is undefined and
-  #     $(DESTDIR) is not.
-  #  To support the latter case, we have to write
-  #     test -z "$(somedir)" || $(mkdir_p) $(DESTDIR)$(somedir),
-  #  so the `.' trick is pointless.
-  mkdir_p='mkdir -p --'
-else
-  # On NextStep and OpenStep, the `mkdir' command does not
-  # recognize any option.  It will interpret all options as
-  # directories to create, and then abort because `.' already
-  # exists.
-  for d in ./-p ./--version;
-  do
-    test -d $d && rmdir $d
-  done
-  # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
-  if test -f "$ac_aux_dir/mkinstalldirs"; then
-    mkdir_p='$(mkinstalldirs)'
-  else
-    mkdir_p='$(install_sh) -d'
-  fi
-fi
-
-for ac_prog in gawk mawk nawk awk
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_AWK+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$AWK"; then
-  ac_cv_prog_AWK="$AWK" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_AWK="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-AWK=$ac_cv_prog_AWK
-if test -n "$AWK"; then
-  { echo "$as_me:$LINENO: result: $AWK" >&5
-echo "${ECHO_T}$AWK" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  test -n "$AWK" && break
-done
-
-{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
-set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
-all:
-       @echo '@@@%%%=$(MAKE)=@@@%%%'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
-  *@@@%%%=?*=@@@%%%*)
-    eval ac_cv_prog_make_${ac_make}_set=yes;;
-  *)
-    eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
-rm -f conftest.make
-fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-  SET_MAKE=
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-rm -rf .tst 2>/dev/null
-mkdir .tst 2>/dev/null
-if test -d .tst; then
-  am__leading_dot=.
-else
-  am__leading_dot=_
-fi
-rmdir .tst 2>/dev/null
-
-# test to see if srcdir already configured
-if test "`cd $srcdir && pwd`" != "`pwd`" &&
-   test -f $srcdir/config.status; then
-  { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
-echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-# test whether we have cygpath
-if test -z "$CYGPATH_W"; then
-  if (cygpath --version) >/dev/null 2>/dev/null; then
-    CYGPATH_W='cygpath -w'
-  else
-    CYGPATH_W=echo
-  fi
-fi
-
-
-# Define the identity of the package.
- PACKAGE='smartmontools'
- VERSION='5.37'
-
-
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE "$PACKAGE"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define VERSION "$VERSION"
-_ACEOF
-
-# Some tools Automake needs.
-
-ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"}
-
-
-AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"}
-
-
-AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"}
-
-
-AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
-
-
-MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-
-install_sh=${install_sh-"$am_aux_dir/install-sh"}
-
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'.  However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-if test "$cross_compiling" != no; then
-  if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$STRIP"; then
-  ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_STRIP="${ac_tool_prefix}strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
-  { echo "$as_me:$LINENO: result: $STRIP" >&5
-echo "${ECHO_T}$STRIP" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
-  ac_ct_STRIP=$STRIP
-  # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_STRIP"; then
-  ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_STRIP="strip"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
-echo "${ECHO_T}$ac_ct_STRIP" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-  if test "x$ac_ct_STRIP" = x; then
-    STRIP=":"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    STRIP=$ac_ct_STRIP
-  fi
-else
-  STRIP="$ac_cv_prog_STRIP"
-fi
-
-fi
-INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
-
-# We need awk for the "check" target.  The system "awk" is bad on
-# some platforms.
-# Always define AMTAR for backward compatibility.
-
-AMTAR=${AMTAR-"${am_missing_run}tar"}
-
-am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'
-
-
-
-
-
-
-{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
-echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
-    # Check whether --enable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then
-  enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
-else
-  USE_MAINTAINER_MODE=no
-fi
-
-  { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
-echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; }
-
-
-if test $USE_MAINTAINER_MODE = yes; then
-  MAINTAINER_MODE_TRUE=
-  MAINTAINER_MODE_FALSE='#'
-else
-  MAINTAINER_MODE_TRUE='#'
-  MAINTAINER_MODE_FALSE=
-fi
-
-  MAINT=$MAINTAINER_MODE_TRUE
-
-
-
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-if test -z "$CXX"; then
-  if test -n "$CCC"; then
-    CXX=$CCC
-  else
-    if test -n "$ac_tool_prefix"; then
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CXX"; then
-  ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CXX=$ac_cv_prog_CXX
-if test -n "$CXX"; then
-  { echo "$as_me:$LINENO: result: $CXX" >&5
-echo "${ECHO_T}$CXX" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-    test -n "$CXX" && break
-  done
-fi
-if test -z "$CXX"; then
-  ac_ct_CXX=$CXX
-  for ac_prog in g++ c++ gpp aCC CC cxx cc++ cl.exe FCC KCC RCC xlC_r xlC
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CXX"; then
-  ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CXX="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
-if test -n "$ac_ct_CXX"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
-echo "${ECHO_T}$ac_ct_CXX" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CXX" && break
-done
-
-  if test "x$ac_ct_CXX" = x; then
-    CXX="g++"
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CXX=$ac_ct_CXX
-  fi
-fi
-
-  fi
-fi
-# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C++ compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.exe b.out"
-# Try to create an executable without -o first, disregard a.out.
-# It will help us diagnose broken compilers, and finding out an intuition
-# of exeext.
-{ echo "$as_me:$LINENO: checking for C++ compiler default output file name" >&5
-echo $ECHO_N "checking for C++ compiler default output file name... $ECHO_C" >&6; }
-ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-#
-# List of possible output files, starting from the most likely.
-# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
-# only as a last resort.  b.out is created by i960 compilers.
-ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
-#
-# The IRIX 6 linker writes into existing files which may not be
-# executable, retaining their permissions.  Remove them first so a
-# subsequent execution test works.
-ac_rmfiles=
-for ac_file in $ac_files
-do
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
-    * ) ac_rmfiles="$ac_rmfiles $ac_file";;
-  esac
-done
-rm -f $ac_rmfiles
-
-if { (ac_try="$ac_link_default"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link_default") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
-# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
-# in a Makefile.  We should not override ac_cv_exeext if it was cached,
-# so that the user can short-circuit this test for compilers unknown to
-# Autoconf.
-for ac_file in $ac_files
-do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
-       ;;
-    [ab].out )
-       # We found the default executable, but exeext='' is most
-       # certainly right.
-       break;;
-    *.* )
-        if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
-       then :; else
-          ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-       fi
-       # We set ac_cv_exeext here because the later test for it is not
-       # safe: cross compilers may not add the suffix if given an `-o'
-       # argument, so we may need to know it at that point already.
-       # Even if this section looks crufty: it has the advantage of
-       # actually working.
-       break;;
-    * )
-       break;;
-  esac
-done
-test "$ac_cv_exeext" = no && ac_cv_exeext=
-
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: C++ compiler cannot create executables
-See \`config.log' for more details." >&5
-echo "$as_me: error: C++ compiler cannot create executables
-See \`config.log' for more details." >&2;}
-   { (exit 77); exit 77; }; }
-fi
-
-ac_exeext=$ac_cv_exeext
-{ echo "$as_me:$LINENO: result: $ac_file" >&5
-echo "${ECHO_T}$ac_file" >&6; }
-
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether the C++ compiler works" >&5
-echo $ECHO_N "checking whether the C++ compiler works... $ECHO_C" >&6; }
-# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
-# If not cross compiling, check that we can run a simple program.
-if test "$cross_compiling" != yes; then
-  if { ac_try='./$ac_file'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-    cross_compiling=no
-  else
-    if test "$cross_compiling" = maybe; then
-       cross_compiling=yes
-    else
-       { { echo "$as_me:$LINENO: error: cannot run C++ compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot run C++ compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-    fi
-  fi
-fi
-{ echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-
-rm -f a.out a.exe conftest$ac_cv_exeext b.out
-ac_clean_files=$ac_clean_files_save
-# Check that the compiler produces executables we can run.  If not, either
-# the compiler is broken, or we cross compile.
-{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
-echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
-{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
-echo "${ECHO_T}$cross_compiling" >&6; }
-
-{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
-echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  # If both `conftest.exe' and `conftest' are `present' (well, observable)
-# catch `conftest.exe'.  For instance with Cygwin, `ls conftest' will
-# work properly (i.e., refer to `conftest.exe'), while it won't with
-# `rm'.
-for ac_file in conftest.exe conftest conftest.*; do
-  test -f "$ac_file" || continue
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
-    *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
-         break;;
-    * ) break;;
-  esac
-done
-else
-  { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest$ac_cv_exeext
-{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
-echo "${ECHO_T}$ac_cv_exeext" >&6; }
-
-rm -f conftest.$ac_ext
-EXEEXT=$ac_cv_exeext
-ac_exeext=$EXEEXT
-{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
-echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
-if test "${ac_cv_objext+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.o conftest.obj
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; then
-  for ac_file in conftest.o conftest.obj conftest.*; do
-  test -f "$ac_file" || continue;
-  case $ac_file in
-    *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
-    *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
-       break;;
-  esac
-done
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&5
-echo "$as_me: error: cannot compute suffix of object files: cannot compile
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-rm -f conftest.$ac_cv_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
-echo "${ECHO_T}$ac_cv_objext" >&6; }
-OBJEXT=$ac_cv_objext
-ac_objext=$OBJEXT
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
-if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_compiler_gnu=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
-GXX=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CXXFLAGS=${CXXFLAGS+set}
-ac_save_CXXFLAGS=$CXXFLAGS
-{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
-echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cxx_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_save_cxx_werror_flag=$ac_cxx_werror_flag
-   ac_cxx_werror_flag=yes
-   ac_cv_prog_cxx_g=no
-   CXXFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cxx_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       CXXFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-        CXXFLAGS="-g"
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cxx_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_cxx_werror_flag=$ac_save_cxx_werror_flag
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
-if test "$ac_test_CXXFLAGS" = set; then
-  CXXFLAGS=$ac_save_CXXFLAGS
-elif test $ac_cv_prog_cxx_g = yes; then
-  if test "$GXX" = yes; then
-    CXXFLAGS="-g -O2"
-  else
-    CXXFLAGS="-g"
-  fi
-else
-  if test "$GXX" = yes; then
-    CXXFLAGS="-O2"
-  else
-    CXXFLAGS=
-  fi
-fi
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-DEPDIR="${am__leading_dot}deps"
-
-ac_config_commands="$ac_config_commands depfiles"
-
-
-am_make=${MAKE-make}
-cat > confinc << 'END'
-am__doit:
-       @echo done
-.PHONY: am__doit
-END
-# If we don't find an include directive, just comment out the code.
-{ echo "$as_me:$LINENO: checking for style of include used by $am_make" >&5
-echo $ECHO_N "checking for style of include used by $am_make... $ECHO_C" >&6; }
-am__include="#"
-am__quote=
-_am_result=none
-# First try GNU make style include.
-echo "include confinc" > confmf
-# We grep out `Entering directory' and `Leaving directory'
-# messages which can occur if `w' ends up in MAKEFLAGS.
-# In particular we don't look at `^make:' because GNU make might
-# be invoked under some other name (usually "gmake"), in which
-# case it prints its new name instead of `make'.
-if test "`$am_make -s -f confmf 2> /dev/null | grep -v 'ing directory'`" = "done"; then
-   am__include=include
-   am__quote=
-   _am_result=GNU
-fi
-# Now try BSD make style include.
-if test "$am__include" = "#"; then
-   echo '.include "confinc"' > confmf
-   if test "`$am_make -s -f confmf 2> /dev/null`" = "done"; then
-      am__include=.include
-      am__quote="\""
-      _am_result=BSD
-   fi
-fi
-
-
-{ echo "$as_me:$LINENO: result: $_am_result" >&5
-echo "${ECHO_T}$_am_result" >&6; }
-rm -f confinc confmf
-
-# Check whether --enable-dependency-tracking was given.
-if test "${enable_dependency_tracking+set}" = set; then
-  enableval=$enable_dependency_tracking;
-fi
-
-if test "x$enable_dependency_tracking" != xno; then
-  am_depcomp="$ac_aux_dir/depcomp"
-  AMDEPBACKSLASH='\'
-fi
-
-
-if test "x$enable_dependency_tracking" != xno; then
-  AMDEP_TRUE=
-  AMDEP_FALSE='#'
-else
-  AMDEP_TRUE='#'
-  AMDEP_FALSE=
-fi
-
-
-
-
-depcc="$CXX"  am_compiler_list=
-
-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
-if test "${am_cv_CXX_dependencies_compiler_type+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_CXX_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
-  fi
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    case $depmode in
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-       continue
-      else
-       break
-      fi
-      ;;
-    none) break ;;
-    esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
-    if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_CXX_dependencies_compiler_type=$depmode
-        break
-      fi
-    fi
-  done
-
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_CXX_dependencies_compiler_type=none
-fi
-
-fi
-{ echo "$as_me:$LINENO: result: $am_cv_CXX_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CXX_dependencies_compiler_type" >&6; }
-CXXDEPMODE=depmode=$am_cv_CXX_dependencies_compiler_type
-
-
-
-if
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_CXX_dependencies_compiler_type" = gcc3; then
-  am__fastdepCXX_TRUE=
-  am__fastdepCXX_FALSE='#'
-else
-  am__fastdepCXX_TRUE='#'
-  am__fastdepCXX_FALSE=
-fi
-
-
-ac_ext=c
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_c_compiler_gnu
-if test -n "$ac_tool_prefix"; then
-  # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_CC"; then
-  ac_ct_CC=$CC
-  # Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="gcc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-else
-  CC="$ac_cv_prog_CC"
-fi
-
-if test -z "$CC"; then
-          if test -n "$ac_tool_prefix"; then
-    # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
-set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="${ac_tool_prefix}cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  fi
-fi
-if test -z "$CC"; then
-  # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-  ac_prog_rejected=no
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
-       ac_prog_rejected=yes
-       continue
-     fi
-    ac_cv_prog_CC="cc"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-if test $ac_prog_rejected = yes; then
-  # We found a bogon in the path, so make sure we never use it.
-  set dummy $ac_cv_prog_CC
-  shift
-  if test $# != 0; then
-    # We chose a different compiler from the bogus one.
-    # However, it has the same basename, so the bogon will be chosen
-    # first if we set CC to just the basename; use the full file name.
-    shift
-    ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@"
-  fi
-fi
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-fi
-if test -z "$CC"; then
-  if test -n "$ac_tool_prefix"; then
-  for ac_prog in cl.exe
-  do
-    # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$CC"; then
-  ac_cv_prog_CC="$CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-CC=$ac_cv_prog_CC
-if test -n "$CC"; then
-  { echo "$as_me:$LINENO: result: $CC" >&5
-echo "${ECHO_T}$CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-    test -n "$CC" && break
-  done
-fi
-if test -z "$CC"; then
-  ac_ct_CC=$CC
-  for ac_prog in cl.exe
-do
-  # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ echo "$as_me:$LINENO: checking for $ac_word" >&5
-echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
-if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -n "$ac_ct_CC"; then
-  ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_exec_ext in '' $ac_executable_extensions; do
-  if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_executable_p "$as_dir/$ac_word$ac_exec_ext"; }; then
-    ac_cv_prog_ac_ct_CC="$ac_prog"
-    echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
-    break 2
-  fi
-done
-done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_CC=$ac_cv_prog_ac_ct_CC
-if test -n "$ac_ct_CC"; then
-  { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
-echo "${ECHO_T}$ac_ct_CC" >&6; }
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-fi
-
-
-  test -n "$ac_ct_CC" && break
-done
-
-  if test "x$ac_ct_CC" = x; then
-    CC=""
-  else
-    case $cross_compiling:$ac_tool_warned in
-yes:)
-{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&5
-echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
-whose name does not start with the host triplet.  If you think this
-configuration is useful to you, please write to autoconf@gnu.org." >&2;}
-ac_tool_warned=yes ;;
-esac
-    CC=$ac_ct_CC
-  fi
-fi
-
-fi
-
-
-test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&5
-echo "$as_me: error: no acceptable C compiler found in \$PATH
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-
-# Provide some information about the compiler.
-echo "$as_me:$LINENO: checking for C compiler version" >&5
-ac_compiler=`set X $ac_compile; echo $2`
-{ (ac_try="$ac_compiler --version >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler --version >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -v >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -v >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-{ (ac_try="$ac_compiler -V >&5"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compiler -V >&5") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }
-
-{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
-echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
-if test "${ac_cv_c_compiler_gnu+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-#ifndef __GNUC__
-       choke me
-#endif
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_compiler_gnu=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_compiler_gnu=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-ac_cv_c_compiler_gnu=$ac_compiler_gnu
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
-echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
-GCC=`test $ac_compiler_gnu = yes && echo yes`
-ac_test_CFLAGS=${CFLAGS+set}
-ac_save_CFLAGS=$CFLAGS
-{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
-echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_g+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_save_c_werror_flag=$ac_c_werror_flag
-   ac_c_werror_flag=yes
-   ac_cv_prog_cc_g=no
-   CFLAGS="-g"
-   cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cc_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       CFLAGS=""
-      cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_c_werror_flag=$ac_save_c_werror_flag
-        CFLAGS="-g"
-        cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cc_g=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-   ac_c_werror_flag=$ac_save_c_werror_flag
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
-if test "$ac_test_CFLAGS" = set; then
-  CFLAGS=$ac_save_CFLAGS
-elif test $ac_cv_prog_cc_g = yes; then
-  if test "$GCC" = yes; then
-    CFLAGS="-g -O2"
-  else
-    CFLAGS="-g"
-  fi
-else
-  if test "$GCC" = yes; then
-    CFLAGS="-O2"
-  else
-    CFLAGS=
-  fi
-fi
-{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
-echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
-if test "${ac_cv_prog_cc_c89+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_cv_prog_cc_c89=no
-ac_save_CC=$CC
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdarg.h>
-#include <stdio.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-/* Most of the following tests are stolen from RCS 5.7's src/conf.sh.  */
-struct buf { int x; };
-FILE * (*rcsopen) (struct buf *, struct stat *, int);
-static char *e (p, i)
-     char **p;
-     int i;
-{
-  return p[i];
-}
-static char *f (char * (*g) (char **, int), char **p, ...)
-{
-  char *s;
-  va_list v;
-  va_start (v,p);
-  s = g (p, va_arg (v,int));
-  va_end (v);
-  return s;
-}
-
-/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default.  It has
-   function prototypes and stuff, but not '\xHH' hex character constants.
-   These don't provoke an error unfortunately, instead are silently treated
-   as 'x'.  The following induces an error, until -std is added to get
-   proper ANSI mode.  Curiously '\x00'!='x' always comes out true, for an
-   array size at least.  It's necessary to write '\x00'==0 to get something
-   that's true only with -std.  */
-int osf4_cc_array ['\x00' == 0 ? 1 : -1];
-
-/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters
-   inside strings and character constants.  */
-#define FOO(x) 'x'
-int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1];
-
-int test (int i, double x);
-struct s1 {int (*f) (int a);};
-struct s2 {int (*f) (double a);};
-int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int);
-int argc;
-char **argv;
-int
-main ()
-{
-return f (e, argv, 0) != argv[0]  ||  f (e, argv, 1) != argv[1];
-  ;
-  return 0;
-}
-_ACEOF
-for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-       -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
-do
-  CC="$ac_save_CC $ac_arg"
-  rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_c_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_prog_cc_c89=$ac_arg
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext
-  test "x$ac_cv_prog_cc_c89" != "xno" && break
-done
-rm -f conftest.$ac_ext
-CC=$ac_save_CC
-
-fi
-# AC_CACHE_VAL
-case "x$ac_cv_prog_cc_c89" in
-  x)
-    { echo "$as_me:$LINENO: result: none needed" >&5
-echo "${ECHO_T}none needed" >&6; } ;;
-  xno)
-    { echo "$as_me:$LINENO: result: unsupported" >&5
-echo "${ECHO_T}unsupported" >&6; } ;;
-  *)
-    CC="$CC $ac_cv_prog_cc_c89"
-    { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
-echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
-esac
-
-
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-depcc="$CC"   am_compiler_list=
-
-{ echo "$as_me:$LINENO: checking dependency style of $depcc" >&5
-echo $ECHO_N "checking dependency style of $depcc... $ECHO_C" >&6; }
-if test "${am_cv_CC_dependencies_compiler_type+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then
-  # We make a subdir and do the tests there.  Otherwise we can end up
-  # making bogus files that we don't know about and never remove.  For
-  # instance it was reported that on HP-UX the gcc test will end up
-  # making a dummy file named `D' -- because `-MD' means `put the output
-  # in D'.
-  mkdir conftest.dir
-  # Copy depcomp to subdir because otherwise we won't find it if we're
-  # using a relative directory.
-  cp "$am_depcomp" conftest.dir
-  cd conftest.dir
-  # We will build objects and dependencies in a subdirectory because
-  # it helps to detect inapplicable dependency modes.  For instance
-  # both Tru64's cc and ICC support -MD to output dependencies as a
-  # side effect of compilation, but ICC will put the dependencies in
-  # the current directory while Tru64 will put them in the object
-  # directory.
-  mkdir sub
-
-  am_cv_CC_dependencies_compiler_type=none
-  if test "$am_compiler_list" = ""; then
-     am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp`
-  fi
-  for depmode in $am_compiler_list; do
-    # Setup a source with many dependencies, because some compilers
-    # like to wrap large dependency lists on column 80 (with \), and
-    # we should not choose a depcomp mode which is confused by this.
-    #
-    # We need to recreate these files for each test, as the compiler may
-    # overwrite some of them when testing with obscure command lines.
-    # This happens at least with the AIX C compiler.
-    : > sub/conftest.c
-    for i in 1 2 3 4 5 6; do
-      echo '#include "conftst'$i'.h"' >> sub/conftest.c
-      # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with
-      # Solaris 8's {/usr,}/bin/sh.
-      touch sub/conftst$i.h
-    done
-    echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf
-
-    case $depmode in
-    nosideeffect)
-      # after this tag, mechanisms are not by side-effect, so they'll
-      # only be used when explicitly requested
-      if test "x$enable_dependency_tracking" = xyes; then
-       continue
-      else
-       break
-      fi
-      ;;
-    none) break ;;
-    esac
-    # We check with `-c' and `-o' for the sake of the "dashmstdout"
-    # mode.  It turns out that the SunPro C++ compiler does not properly
-    # handle `-M -o', and we need to detect this.
-    if depmode=$depmode \
-       source=sub/conftest.c object=sub/conftest.${OBJEXT-o} \
-       depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \
-       $SHELL ./depcomp $depcc -c -o sub/conftest.${OBJEXT-o} sub/conftest.c \
-         >/dev/null 2>conftest.err &&
-       grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 &&
-       grep sub/conftest.${OBJEXT-o} sub/conftest.Po > /dev/null 2>&1 &&
-       ${MAKE-make} -s -f confmf > /dev/null 2>&1; then
-      # icc doesn't choke on unknown options, it will just issue warnings
-      # or remarks (even with -Werror).  So we grep stderr for any message
-      # that says an option was ignored or not supported.
-      # When given -MP, icc 7.0 and 7.1 complain thusly:
-      #   icc: Command line warning: ignoring option '-M'; no argument required
-      # The diagnosis changed in icc 8.0:
-      #   icc: Command line remark: option '-MP' not supported
-      if (grep 'ignoring option' conftest.err ||
-          grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else
-        am_cv_CC_dependencies_compiler_type=$depmode
-        break
-      fi
-    fi
-  done
-
-  cd ..
-  rm -rf conftest.dir
-else
-  am_cv_CC_dependencies_compiler_type=none
-fi
-
-fi
-{ echo "$as_me:$LINENO: result: $am_cv_CC_dependencies_compiler_type" >&5
-echo "${ECHO_T}$am_cv_CC_dependencies_compiler_type" >&6; }
-CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type
-
-
-
-if
-  test "x$enable_dependency_tracking" != xno \
-  && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then
-  am__fastdepCC_TRUE=
-  am__fastdepCC_FALSE='#'
-else
-  am__fastdepCC_TRUE='#'
-  am__fastdepCC_FALSE=
-fi
-
-
-# By default we simply use the C compiler to build assembly code.
-
-test "${CCAS+set}" = set || CCAS=$CC
-test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS
-
-
-
-# Find a good install program.  We prefer a C program (faster),
-# so one script is as good as another.  But avoid the broken or
-# incompatible versions:
-# SysV /etc/install, /usr/sbin/install
-# SunOS /usr/etc/install
-# IRIX /sbin/install
-# AIX /bin/install
-# AmigaOS /C/install, which installs bootblocks on floppy discs
-# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag
-# AFS /usr/afsws/bin/install, which mishandles nonexistent args
-# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
-# OS/2's system install, which has a completely different semantic
-# ./install, which can be erroneously created by make from ./install.sh.
-{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
-echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
-if test -z "$INSTALL"; then
-if test "${ac_cv_path_install+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in
-  ./ | .// | /cC/* | \
-  /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
-  ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
-  /usr/ucb/* ) ;;
-  *)
-    # OSF1 and SCO ODT 3.0 have their own names for install.
-    # Don't use installbsd from OSF since it installs stuff as root
-    # by default.
-    for ac_prog in ginstall scoinst install; do
-      for ac_exec_ext in '' $ac_executable_extensions; do
-       if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_executable_p "$as_dir/$ac_prog$ac_exec_ext"; }; then
-         if test $ac_prog = install &&
-           grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-           # AIX install.  It has an incompatible calling convention.
-           :
-         elif test $ac_prog = install &&
-           grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
-           # program-specific install script used by HP pwplus--don't use.
-           :
-         else
-           ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
-           break 3
-         fi
-       fi
-      done
-    done
-    ;;
-esac
-done
-IFS=$as_save_IFS
-
-
-fi
-  if test "${ac_cv_path_install+set}" = set; then
-    INSTALL=$ac_cv_path_install
-  else
-    # As a last resort, use the slow shell script.  Don't cache a
-    # value for INSTALL within a source directory, because that will
-    # break other packages using the cache if that directory is
-    # removed, or if the value is a relative name.
-    INSTALL=$ac_install_sh
-  fi
-fi
-{ echo "$as_me:$LINENO: result: $INSTALL" >&5
-echo "${ECHO_T}$INSTALL" >&6; }
-
-# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
-# It thinks the first close brace ends the variable substitution.
-test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}'
-
-test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
-
-test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-
-
-# Make sure we can run config.sub.
-$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
-  { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
-echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
-   { (exit 1); exit 1; }; }
-
-{ echo "$as_me:$LINENO: checking build system type" >&5
-echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
-if test "${ac_cv_build+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_build_alias=$build_alias
-test "x$ac_build_alias" = x &&
-  ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
-test "x$ac_build_alias" = x &&
-  { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
-echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
-   { (exit 1); exit 1; }; }
-ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
-  { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
-echo "${ECHO_T}$ac_cv_build" >&6; }
-case $ac_cv_build in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
-echo "$as_me: error: invalid value of canonical build" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-build=$ac_cv_build
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_build
-shift
-build_cpu=$1
-build_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-build_os=$*
-IFS=$ac_save_IFS
-case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-
-
-{ echo "$as_me:$LINENO: checking host system type" >&5
-echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
-if test "${ac_cv_host+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if test "x$host_alias" = x; then
-  ac_cv_host=$ac_cv_build
-else
-  ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
-    { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
-echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
-echo "${ECHO_T}$ac_cv_host" >&6; }
-case $ac_cv_host in
-*-*-*) ;;
-*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
-echo "$as_me: error: invalid value of canonical host" >&2;}
-   { (exit 1); exit 1; }; };;
-esac
-host=$ac_cv_host
-ac_save_IFS=$IFS; IFS='-'
-set x $ac_cv_host
-shift
-host_cpu=$1
-host_vendor=$2
-shift; shift
-# Remember, the first character of IFS is used to create $*,
-# except with old shells:
-host_os=$*
-IFS=$ac_save_IFS
-case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-
-
-case "${host}" in
-       *-*-mingw*)
-               CPPFLAGS="$CPPFLAGS -mno-cygwin"
-               LDFLAGS="$LDFLAGS -mno-cygwin"
-               CPPFLAGS="$CPPFLAGS -idirafter ${srcdir}/posix -idirafter ${srcdir}/os_win32"
-esac
-
-#  AC_SEARCH_LIBS (FUNCTION, SEARCH-LIBS, [ACTION-IF-FOUND], [ACTION-IF-NOT-FOUND], [OTHER-LIBRARIES])
-{ echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5
-echo $ECHO_N "checking for library containing gethostbyname... $ECHO_C" >&6; }
-if test "${ac_cv_search_gethostbyname+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gethostbyname ();
-int
-main ()
-{
-return gethostbyname ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' nsl; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib  $ac_func_search_save_LIBS"
-  fi
-  rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_gethostbyname=$ac_res
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext
-  if test "${ac_cv_search_gethostbyname+set}" = set; then
-  break
-fi
-done
-if test "${ac_cv_search_gethostbyname+set}" = set; then
-  :
-else
-  ac_cv_search_gethostbyname=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_search_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_search_gethostbyname" >&6; }
-ac_res=$ac_cv_search_gethostbyname
-if test "$ac_res" != no; then
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-else
-  { echo "$as_me:$LINENO: checking for library containing gethostbyname" >&5
-echo $ECHO_N "checking for library containing gethostbyname... $ECHO_C" >&6; }
-if test "${ac_cv_search_gethostbyname+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_func_search_save_LIBS=$LIBS
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char gethostbyname ();
-int
-main ()
-{
-return gethostbyname ();
-  ;
-  return 0;
-}
-_ACEOF
-for ac_lib in '' nsl; do
-  if test -z "$ac_lib"; then
-    ac_res="none required"
-  else
-    ac_res=-l$ac_lib
-    LIBS="-l$ac_lib -lsocket $ac_func_search_save_LIBS"
-  fi
-
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_search_gethostbyname=$ac_res
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext
-  if test "${ac_cv_search_gethostbyname+set}" = set; then
-  break
-fi
-done
-if test "${ac_cv_search_gethostbyname+set}" = set; then
-  :
-else
-  ac_cv_search_gethostbyname=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_search_gethostbyname" >&5
-echo "${ECHO_T}$ac_cv_search_gethostbyname" >&6; }
-ac_res=$ac_cv_search_gethostbyname
-if test "$ac_res" != no; then
-  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
-
-fi
-
-fi
-
-
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
-echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
-if test -z "$CXXCPP"; then
-  if test "${ac_cv_prog_CXXCPP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-      # Double quotes because CXXCPP needs to be expanded
-    for CXXCPP in "$CXX -E" "/lib/cpp"
-    do
-      ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  # Broken: success on invalid input.
-continue
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  break
-fi
-
-    done
-    ac_cv_prog_CXXCPP=$CXXCPP
-
-fi
-  CXXCPP=$ac_cv_prog_CXXCPP
-else
-  ac_cv_prog_CXXCPP=$CXXCPP
-fi
-{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
-echo "${ECHO_T}$CXXCPP" >&6; }
-ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
-  # Use a header file that comes with gcc, so configuring glibc
-  # with a fresh cross-compiler works.
-  # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-  # <limits.h> exists even on freestanding compilers.
-  # On the NeXT, cc -E runs the code through the compiler's parser,
-  # not just through cpp. "Syntax error" is here to catch this case.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-                    Syntax error
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  :
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Broken: fails on valid input.
-continue
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-  # OK, works on sane cases.  Now check whether nonexistent headers
-  # can be detected and how.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ac_nonexistent.h>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  # Broken: success on invalid input.
-continue
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-
-rm -f conftest.err conftest.$ac_ext
-
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then
-  :
-else
-  { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." >&5
-echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-
-
-{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
-echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  # Extract the first word of "grep ggrep" to use in msg output
-if test -z "$GREP"; then
-set dummy grep ggrep; ac_prog_name=$2
-if test "${ac_cv_path_GREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_path_GREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in grep ggrep; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_GREP" && $as_executable_p "$ac_path_GREP"; } || continue
-    # Check for GNU ac_path_GREP and select it if it is found.
-  # Check for GNU $ac_path_GREP
-case `"$ac_path_GREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
-*)
-  ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    echo 'GREP' >> "conftest.nl"
-    "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_GREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_GREP="$ac_path_GREP"
-      ac_path_GREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
-    $ac_path_GREP_found && break 3
-  done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-GREP="$ac_cv_path_GREP"
-if test -z "$GREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-else
-  ac_cv_path_GREP=$GREP
-fi
-
-
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
-echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
- GREP="$ac_cv_path_GREP"
-
-
-{ echo "$as_me:$LINENO: checking for egrep" >&5
-echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
-if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
-   then ac_cv_path_EGREP="$GREP -E"
-   else
-     # Extract the first word of "egrep" to use in msg output
-if test -z "$EGREP"; then
-set dummy egrep; ac_prog_name=$2
-if test "${ac_cv_path_EGREP+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  ac_path_EGREP_found=false
-# Loop through the user's path and test for each of PROGNAME-LIST
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  for ac_prog in egrep; do
-  for ac_exec_ext in '' $ac_executable_extensions; do
-    ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
-    { test -f "$ac_path_EGREP" && $as_executable_p "$ac_path_EGREP"; } || continue
-    # Check for GNU ac_path_EGREP and select it if it is found.
-  # Check for GNU $ac_path_EGREP
-case `"$ac_path_EGREP" --version 2>&1` in
-*GNU*)
-  ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
-*)
-  ac_count=0
-  echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
-  while :
-  do
-    cat "conftest.in" "conftest.in" >"conftest.tmp"
-    mv "conftest.tmp" "conftest.in"
-    cp "conftest.in" "conftest.nl"
-    echo 'EGREP' >> "conftest.nl"
-    "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
-    diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
-    ac_count=`expr $ac_count + 1`
-    if test $ac_count -gt ${ac_path_EGREP_max-0}; then
-      # Best one so far, save it but keep looking for a better one
-      ac_cv_path_EGREP="$ac_path_EGREP"
-      ac_path_EGREP_max=$ac_count
-    fi
-    # 10*(2^10) chars as input seems more than enough
-    test $ac_count -gt 10 && break
-  done
-  rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
-
-    $ac_path_EGREP_found && break 3
-  done
-done
-
-done
-IFS=$as_save_IFS
-
-
-fi
-
-EGREP="$ac_cv_path_EGREP"
-if test -z "$EGREP"; then
-  { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
-echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-else
-  ac_cv_path_EGREP=$EGREP
-fi
-
-
-   fi
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
-echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
- EGREP="$ac_cv_path_EGREP"
-
-
-{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
-echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
-if test "${ac_cv_header_stdc+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_header_stdc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_header_stdc=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
-  # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "memchr" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
-  $EGREP "free" >/dev/null 2>&1; then
-  :
-else
-  ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
-  # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
-  if test "$cross_compiling" = yes; then
-  :
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
-                  (('a' <= (c) && (c) <= 'i') \
-                    || ('j' <= (c) && (c) <= 'r') \
-                    || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
-  int i;
-  for (i = 0; i < 256; i++)
-    if (XOR (islower (i), ISLOWER (i))
-       || toupper (i) != TOUPPER (i))
-      return 2;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  :
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-fi
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
-echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-cat >>confdefs.h <<\_ACEOF
-#define STDC_HEADERS 1
-_ACEOF
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-
-
-
-
-
-
-
-
-
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
-                 inttypes.h stdint.h unistd.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_Header=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_Header=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-
-for ac_header in locale.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in getopt.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in dev/ata/atavar.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in netdb.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in inttypes.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-for ac_header in stdint.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-for ac_header in sys/inttypes.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-for ac_header in sys/int_types.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-for ac_header in sys/tweio.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/twereg.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in sys/tw_osl_ioctl.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in linux/compiler.h
-do
-as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  { echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-else
-  # Is the header compilable?
-{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
-echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-#include <$ac_header>
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_header_compiler=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_header_compiler=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
-echo "${ECHO_T}$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
-echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <$ac_header>
-_ACEOF
-if { (ac_try="$ac_cpp conftest.$ac_ext"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } >/dev/null; then
-  if test -s conftest.err; then
-    ac_cpp_err=$ac_cxx_preproc_warn_flag
-    ac_cpp_err=$ac_cpp_err$ac_cxx_werror_flag
-  else
-    ac_cpp_err=
-  fi
-else
-  ac_cpp_err=yes
-fi
-if test -z "$ac_cpp_err"; then
-  ac_header_preproc=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-  ac_header_preproc=no
-fi
-
-rm -f conftest.err conftest.$ac_ext
-{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
-echo "${ECHO_T}$ac_header_preproc" >&6; }
-
-# So?  What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
-  yes:no: )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
-echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
-    ac_header_preproc=yes
-    ;;
-  no:yes:* )
-    { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
-echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     check for missing prerequisite headers?" >&5
-echo "$as_me: WARNING: $ac_header:     check for missing prerequisite headers?" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
-echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&5
-echo "$as_me: WARNING: $ac_header:     section \"Present But Cannot Be Compiled\"" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
-echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
-    { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
-echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
-    ( cat <<\_ASBOX
-## ---------------------------------------------------------- ##
-## Report this to smartmontools-support@lists.sourceforge.net ##
-## ---------------------------------------------------------- ##
-_ASBOX
-     ) | sed "s/^/$as_me: WARNING:     /" >&2
-    ;;
-esac
-{ echo "$as_me:$LINENO: checking for $ac_header" >&5
-echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
-if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  eval "$as_ac_Header=\$ac_header_preproc"
-fi
-ac_res=`eval echo '${'$as_ac_Header'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-
-fi
-if test `eval echo '${'$as_ac_Header'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-{ echo "$as_me:$LINENO: checking for int64_t" >&5
-echo $ECHO_N "checking for int64_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_int64_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-typedef int64_t ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_int64_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_int64_t=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_int64_t" >&5
-echo "${ECHO_T}$ac_cv_type_int64_t" >&6; }
-if test $ac_cv_type_int64_t = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_INT64_T 1
-_ACEOF
-
-
-fi
-{ echo "$as_me:$LINENO: checking for uint64_t" >&5
-echo $ECHO_N "checking for uint64_t... $ECHO_C" >&6; }
-if test "${ac_cv_type_uint64_t+set}" = set; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-$ac_includes_default
-typedef uint64_t ac__type_new_;
-int
-main ()
-{
-if ((ac__type_new_ *) 0)
-  return 0;
-if (sizeof (ac__type_new_))
-  return 0;
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  ac_cv_type_uint64_t=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       ac_cv_type_uint64_t=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-{ echo "$as_me:$LINENO: result: $ac_cv_type_uint64_t" >&5
-echo "${ECHO_T}$ac_cv_type_uint64_t" >&6; }
-if test $ac_cv_type_uint64_t = yes; then
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_UINT64_T 1
-_ACEOF
-
-
-fi
-
-
-
-for ac_func in getopt
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in getopt_long
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in getdomainname
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in gethostname
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in gethostbyname
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in sigset
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in strtoull
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-for ac_func in uname
-do
-as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
-{ echo "$as_me:$LINENO: checking for $ac_func" >&5
-echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
-if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
-   For example, HP-UX 11i <limits.h> declares gettimeofday.  */
-#define $ac_func innocuous_$ac_func
-
-/* System header to define __stub macros and hopefully few prototypes,
-    which can conflict with char $ac_func (); below.
-    Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
-    <limits.h> exists even on freestanding compilers.  */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $ac_func
-
-/* Override any GCC internal prototype to avoid an error.
-   Use char because int might match the return type of a GCC
-   builtin and then its argument prototype would still apply.  */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $ac_func ();
-/* The GNU C library defines this for functions which it implements
-    to always fail with ENOSYS.  Some functions are actually named
-    something starting with __ and the normal name is an alias.  */
-#if defined __stub_$ac_func || defined __stub___$ac_func
-choke me
-#endif
-
-int
-main ()
-{
-return $ac_func ();
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  eval "$as_ac_var=yes"
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       eval "$as_ac_var=no"
-fi
-
-rm -f core conftest.err conftest.$ac_objext \
-      conftest$ac_exeext conftest.$ac_ext
-fi
-ac_res=`eval echo '${'$as_ac_var'}'`
-              { echo "$as_me:$LINENO: result: $ac_res" >&5
-echo "${ECHO_T}$ac_res" >&6; }
-if test `eval echo '${'$as_ac_var'}'` = yes; then
-  cat >>confdefs.h <<_ACEOF
-#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-done
-
-
-# Check whether snprintf appends null char and returns expected length on overflow
-
-
-{ echo "$as_me:$LINENO: checking for working snprintf" >&5
-echo $ECHO_N "checking for working snprintf... $ECHO_C" >&6; }
-if test "$cross_compiling" = yes; then
-  libc_have_working_snprintf=no
-else
-  cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-#include <stdio.h>
-int
-main ()
-{
- char buf[]="ABCDEFGHI";
-               int i=snprintf(buf,8,"12345678"); return !(!buf[7] && i==8);
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest$ac_exeext
-if { (ac_try="$ac_link"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_link") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  libc_have_working_snprintf=yes
-else
-  echo "$as_me: program exited with status $ac_status" >&5
-echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-( exit $ac_status )
-libc_have_working_snprintf=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
-fi
-
-
-
-if test "$libc_have_working_snprintf" = "yes"; then
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_WORKING_SNPRINTF 1
-_ACEOF
-
-fi
-{ echo "$as_me:$LINENO: result: $libc_have_working_snprintf" >&5
-echo "${ECHO_T}$libc_have_working_snprintf" >&6; }
-
-# check for __attribute__((packed))
-
-
-{ echo "$as_me:$LINENO: checking whether C++ compiler supports __attribute__((packed))" >&5
-echo $ECHO_N "checking whether C++ compiler supports __attribute__((packed))... $ECHO_C" >&6; }
-cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h.  */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
-/* end confdefs.h.  */
-
-int
-main ()
-{
-struct a { int b; } __attribute__((packed));
-  ;
-  return 0;
-}
-_ACEOF
-rm -f conftest.$ac_objext
-if { (ac_try="$ac_compile"
-case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_compile") 2>conftest.er1
-  ac_status=$?
-  grep -v '^ *+' conftest.er1 >conftest.err
-  rm -f conftest.er1
-  cat conftest.err >&5
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); } &&
-        { ac_try='test -z "$ac_cxx_werror_flag" || test ! -s conftest.err'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; } &&
-        { ac_try='test -s conftest.$ac_objext'
-  { (case "(($ac_try" in
-  *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
-  *) ac_try_echo=$ac_try;;
-esac
-eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
-  (eval "$ac_try") 2>&5
-  ac_status=$?
-  echo "$as_me:$LINENO: \$? = $ac_status" >&5
-  (exit $ac_status); }; }; then
-  gcc_have_attr_packed=yes
-else
-  echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
-       gcc_have_attr_packed=no
-fi
-
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test "$gcc_have_attr_packed" = "yes"; then
-  cat >>confdefs.h <<\_ACEOF
-#define HAVE_ATTR_PACKED 1
-_ACEOF
-
-fi
-{ echo "$as_me:$LINENO: result: $gcc_have_attr_packed" >&5
-echo "${ECHO_T}$gcc_have_attr_packed" >&6; }
-
-
-
-
-
-exampledir='${docdir}/examplescripts'
-
-
-
-# Check whether --with-initscriptdir was given.
-if test "${with_initscriptdir+set}" = set; then
-  withval=$with_initscriptdir; initddir="$withval"
-else
-  initddir='${sysconfdir}/rc.d/init.d'
-fi
-
-
-
-
-# Check whether --with-docdir was given.
-if test "${with_docdir+set}" = set; then
-  withval=$with_docdir; docdir="$withval"
-else
-  docdir='${prefix}/share/doc/${PACKAGE}-${VERSION}'
-fi
-
-
-
-# Check whether --enable-sample was given.
-if test "${enable_sample+set}" = set; then
-  enableval=$enable_sample; smartd_suffix='.sample'
-else
-  smartd_suffix=''
-fi
-
-
-
-
-if test $smartd_suffix; then
-  SMARTD_SUFFIX_TRUE=
-  SMARTD_SUFFIX_FALSE='#'
-else
-  SMARTD_SUFFIX_TRUE='#'
-  SMARTD_SUFFIX_FALSE=
-fi
-
-
-if test "$prefix" = "NONE"; then
-        if test "$mandir" = '${prefix}/man'; then
-       mandir='${prefix}/share/man'
-
-    fi
-fi
-
-releaseversion='${PACKAGE}-${VERSION}'
-
-
-
-
-case "${host}" in
-       *-*-linux-gnu*)
-               os_deps='os_linux.o'
-
-               os_libs=''
- ;;
-       *-*-linux*)
-               os_deps='os_linux.o'
-
-               os_libs=''
- ;;
-       *-*-freebsd*)
-               os_deps='os_freebsd.o'
-
-               os_libs='-lcam'
-;;
-       sparc-*-solaris*)
-
-cat >>confdefs.h <<_ACEOF
-#define DEFAULT_MAILER "mailx"
-_ACEOF
-
-
-cat >>confdefs.h <<_ACEOF
-#define NEED_SOLARIS_ATA_CODE "os_solaris_ata.s"
-_ACEOF
-
-               os_deps='os_solaris.o os_solaris_ata.o'
-
-               os_libs=''
- ;;
-       *-pc-solaris*)
-
-cat >>confdefs.h <<_ACEOF
-#define DEFAULT_MAILER "mailx"
-_ACEOF
-
-               os_deps='os_solaris.o'
-
-               os_libs=''
- ;;
-       *-*-netbsd*)
-               os_deps='os_netbsd.o'
-
-               os_libs='-lutil'
- ;;
-       *-*-openbsd*)
-               os_deps='os_openbsd.o'
-
-               os_libs='-lutil'
- ;;
-       *-*-cygwin*)
-               os_deps='os_win32.o'
-
-               os_libs=''
- ;;
-       *-*-mingw*)
-               os_deps='os_win32.o'
-
-               os_libs=''
- ;;
-       *-*-darwin*)
-               os_deps='os_darwin.o'
-
-               os_libs='-framework CoreFoundation -framework IOKit'
- ;;
-       *)
-               os_deps='os_generic.o'
-
-               os_libs=''
- ;;
-esac
-
-# Define symbols for optional functions in OS specific module
-case "${os_deps}" in
-  os_win32*)
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_ATA_IDENTIFY_IS_CACHED 1
-_ACEOF
- ;;
-esac
-case "${os_deps}" in
-  os_win32*)
-
-cat >>confdefs.h <<\_ACEOF
-#define HAVE_GET_OS_VERSION_STR 1
-_ACEOF
- ;;
-esac
-
-
-
-if echo $host_os | grep '^darwin' > /dev/null; then
-  OS_DARWIN_TRUE=
-  OS_DARWIN_FALSE='#'
-else
-  OS_DARWIN_TRUE='#'
-  OS_DARWIN_FALSE=
-fi
-
-
-
-if echo $host_os | grep '^solaris' > /dev/null; then
-  OS_SOLARIS_TRUE=
-  OS_SOLARIS_FALSE='#'
-else
-  OS_SOLARIS_TRUE='#'
-  OS_SOLARIS_FALSE=
-fi
-
-
-
-if echo $host_os | grep '^mingw' > /dev/null; then
-  OS_WIN32_MINGW_TRUE=
-  OS_WIN32_MINGW_FALSE='#'
-else
-  OS_WIN32_MINGW_TRUE='#'
-  OS_WIN32_MINGW_FALSE=
-fi
-
-
-if test "x$GCC" = "xyes"; then
-  if test -z "`echo "$CXXFLAGS" | grep "\-Wall" 2> /dev/null`" ; then
-      CXXFLAGS="$CXXFLAGS -Wall"
-  fi
-# In the next line, do NOT delete the 2 spaces inside double quotes.
-  if test -z "`echo "$CXXFLAGS " | grep "\-W " 2> /dev/null`" ; then
-      CXXFLAGS="$CXXFLAGS -W"
-  fi
-  case "${host}" in
-    *-*-mingw*)
-      # MinGW uses MSVCRT.DLL which uses printf format "%I64d" and not "%lld" for int64_t
-      CXXFLAGS="$CXXFLAGS -Wno-format";;
-  esac
-else
-  case "${host}" in
-       *-*-solaris*)
-                    if test -z "`echo "$CXXFLAGS" | grep "\-xmemalign" 2> /dev/null`" ; then
-                        CXXFLAGS="-xmemalign=1i $CXXFLAGS"
-          fi
-          if test -z "`echo "$CXXFLAGS" | grep "\-xO" 2> /dev/null`" ; then
-                        CXXFLAGS="-xO2 $CXXFLAGS"
-          fi
-          if test -z "`echo "$CXXFLAGS" | grep "\-erroff" 2> /dev/null`" ; then
-                           CXXFLAGS="-erroff=%none,wbadinitl,wbadasgl,badargtypel2w $CXXFLAGS"
-         fi
- esac
-fi
-
-
-cat >>confdefs.h <<_ACEOF
-#define SMARTMONTOOLS_BUILD_HOST "${host}"
-_ACEOF
-
-
-
-
-ac_config_files="$ac_config_files Makefile examplescripts/Makefile"
-
-cat >confcache <<\_ACEOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs, see configure's option --config-cache.
-# It is not useful on other systems.  If it contains results you don't
-# want to keep, you may remove or edit it.
-#
-# config.status only pays attention to the cache file if you give it
-# the --recheck option to rerun configure.
-#
-# `ac_cv_env_foo' variables (set or unset) will be overridden when
-# loading this file, other *unset* `ac_cv_foo' will be assigned the
-# following values.
-
-_ACEOF
-
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, we kill variables containing newlines.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(
-  for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do
-    eval ac_val=\$$ac_var
-    case $ac_val in #(
-    *${as_nl}*)
-      case $ac_var in #(
-      *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
-echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
-      esac
-      case $ac_var in #(
-      _ | IFS | as_nl) ;; #(
-      *) $as_unset $ac_var ;;
-      esac ;;
-    esac
-  done
-
-  (set) 2>&1 |
-    case $as_nl`(ac_space=' '; set) 2>&1` in #(
-    *${as_nl}ac_space=\ *)
-      # `set' does not quote correctly, so add quotes (double-quote
-      # substitution turns \\\\ into \\, and sed turns \\ into \).
-      sed -n \
-       "s/'/'\\\\''/g;
-         s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
-      ;; #(
-    *)
-      # `set' quotes correctly as required by POSIX, so do not add quotes.
-      sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p"
-      ;;
-    esac |
-    sort
-) |
-  sed '
-     /^ac_cv_env_/b end
-     t clear
-     :clear
-     s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/
-     t end
-     s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/
-     :end' >>confcache
-if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
-  if test -w "$cache_file"; then
-    test "x$cache_file" != "x/dev/null" &&
-      { echo "$as_me:$LINENO: updating cache $cache_file" >&5
-echo "$as_me: updating cache $cache_file" >&6;}
-    cat confcache >$cache_file
-  else
-    { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
-echo "$as_me: not updating unwritable cache $cache_file" >&6;}
-  fi
-fi
-rm -f confcache
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-DEFS=-DHAVE_CONFIG_H
-
-ac_libobjs=
-ac_ltlibobjs=
-for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
-  # 1. Remove the extension, and $U if already installed.
-  ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
-  ac_i=`echo "$ac_i" | sed "$ac_script"`
-  # 2. Prepend LIBOBJDIR.  When used with automake>=1.10 LIBOBJDIR
-  #    will be set to the directory where LIBOBJS objects are built.
-  ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
-  ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
-done
-LIBOBJS=$ac_libobjs
-
-LTLIBOBJS=$ac_ltlibobjs
-
-
-if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"AMDEP\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${am__fastdepCXX_TRUE}" && test -z "${am__fastdepCXX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCXX\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"am__fastdepCXX\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"am__fastdepCC\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${SMARTD_SUFFIX_TRUE}" && test -z "${SMARTD_SUFFIX_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"SMARTD_SUFFIX\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"SMARTD_SUFFIX\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${OS_DARWIN_TRUE}" && test -z "${OS_DARWIN_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"OS_DARWIN\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"OS_DARWIN\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${OS_SOLARIS_TRUE}" && test -z "${OS_SOLARIS_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"OS_SOLARIS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"OS_SOLARIS\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-if test -z "${OS_WIN32_MINGW_TRUE}" && test -z "${OS_WIN32_MINGW_FALSE}"; then
-  { { echo "$as_me:$LINENO: error: conditional \"OS_WIN32_MINGW\" was never defined.
-Usually this means the macro was only invoked conditionally." >&5
-echo "$as_me: error: conditional \"OS_WIN32_MINGW\" was never defined.
-Usually this means the macro was only invoked conditionally." >&2;}
-   { (exit 1); exit 1; }; }
-fi
-
-: ${CONFIG_STATUS=./config.status}
-ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
-echo "$as_me: creating $CONFIG_STATUS" >&6;}
-cat >$CONFIG_STATUS <<_ACEOF
-#! $SHELL
-# Generated by $as_me.
-# Run this file to recreate the current configuration.
-# Compiler output produced by configure, useful for debugging
-# configure, is in config.log if it exists.
-
-debug=false
-ac_cs_recheck=false
-ac_cs_silent=false
-SHELL=\${CONFIG_SHELL-$SHELL}
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-## --------------------- ##
-## M4sh Initialization.  ##
-## --------------------- ##
-
-# Be Bourne compatible
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
-  emulate sh
-  NULLCMD=:
-  # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
-  # is contrary to our usage.  Disable this feature.
-  alias -g '${1+"$@"}'='"$@"'
-  setopt NO_GLOB_SUBST
-else
-  case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-
-# PATH needs CR
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
-
-# The user is always right.
-if test "${PATH_SEPARATOR+set}" != set; then
-  echo "#! /bin/sh" >conf$$.sh
-  echo  "exit 0"   >>conf$$.sh
-  chmod +x conf$$.sh
-  if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
-    PATH_SEPARATOR=';'
-  else
-    PATH_SEPARATOR=:
-  fi
-  rm -f conf$$.sh
-fi
-
-# Support unset when possible.
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
-  as_unset=unset
-else
-  as_unset=false
-fi
-
-
-# IFS
-# We need space, tab and new line, in precisely that order.  Quoting is
-# there to prevent editors from complaining about space-tab.
-# (If _AS_PATH_WALK were called with IFS unset, it would disable word
-# splitting by setting IFS to empty value.)
-as_nl='
-'
-IFS=" ""       $as_nl"
-
-# Find who we are.  Look in the path if we contain no directory separator.
-case $0 in
-  *[\\/]* ) as_myself=$0 ;;
-  *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
-  IFS=$as_save_IFS
-  test -z "$as_dir" && as_dir=.
-  test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
-done
-IFS=$as_save_IFS
-
-     ;;
-esac
-# We did not find ourselves, most probably we were run as `sh COMMAND'
-# in which case we are not to be found in the path.
-if test "x$as_myself" = x; then
-  as_myself=$0
-fi
-if test ! -f "$as_myself"; then
-  echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
-  { (exit 1); exit 1; }
-fi
-
-# Work around bugs in pre-3.0 UWIN ksh.
-for as_var in ENV MAIL MAILPATH
-do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-done
-PS1='$ '
-PS2='> '
-PS4='+ '
-
-# NLS nuisances.
-for as_var in \
-  LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
-  LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
-  LC_TELEPHONE LC_TIME
-do
-  if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
-    eval $as_var=C; export $as_var
-  else
-    ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
-  fi
-done
-
-# Required to use basename.
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
-  as_basename=basename
-else
-  as_basename=false
-fi
-
-
-# Name of the executable.
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
-        X"$0" : 'X\(//\)$' \| \
-        X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-echo X/"$0" |
-    sed '/^.*\/\([^/][^/]*\)\/*$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\/\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-
-# CDPATH.
-$as_unset CDPATH
-
-
-
-  as_lineno_1=$LINENO
-  as_lineno_2=$LINENO
-  test "x$as_lineno_1" != "x$as_lineno_2" &&
-  test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
-
-  # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
-  # uniformly replaced by the line number.  The first 'sed' inserts a
-  # line-number line after each line using $LINENO; the second 'sed'
-  # does the real work.  The second script uses 'N' to pair each
-  # line-number line with the line containing $LINENO, and appends
-  # trailing '-' during substitution so that $LINENO is not a special
-  # case at line end.
-  # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
-  # scripts with optimization help from Paolo Bonzini.  Blame Lee
-  # E. McMahon (1931-1989) for sed's syntax.  :-)
-  sed -n '
-    p
-    /[$]LINENO/=
-  ' <$as_myself |
-    sed '
-      s/[$]LINENO.*/&-/
-      t lineno
-      b
-      :lineno
-      N
-      :loop
-      s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
-      t loop
-      s/-\n.*//
-    ' >$as_me.lineno &&
-  chmod +x "$as_me.lineno" ||
-    { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
-   { (exit 1); exit 1; }; }
-
-  # Don't try to exec as it changes $[0], causing all sort of problems
-  # (the dirname of $[0] is not the place where we might find the
-  # original and so on.  Autoconf is especially sensitive to this).
-  . "./$as_me.lineno"
-  # Exit status is that of the last command.
-  exit
-}
-
-
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
-  as_dirname=dirname
-else
-  as_dirname=false
-fi
-
-ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in
--n*)
-  case `echo 'x\c'` in
-  *c*) ECHO_T='        ';;     # ECHO_T is single tab character.
-  *)   ECHO_C='\c';;
-  esac;;
-*)
-  ECHO_N='-n';;
-esac
-
-if expr a : '\(a\)' >/dev/null 2>&1 &&
-   test "X`expr 00001 : '.*\(...\)'`" = X001; then
-  as_expr=expr
-else
-  as_expr=false
-fi
-
-rm -f conf$$ conf$$.exe conf$$.file
-if test -d conf$$.dir; then
-  rm -f conf$$.dir/conf$$.file
-else
-  rm -f conf$$.dir
-  mkdir conf$$.dir
-fi
-echo >conf$$.file
-if ln -s conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s='ln -s'
-  # ... but there are two gotchas:
-  # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
-  # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
-  # In both cases, we have to default to `cp -p'.
-  ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
-    as_ln_s='cp -p'
-elif ln conf$$.file conf$$ 2>/dev/null; then
-  as_ln_s=ln
-else
-  as_ln_s='cp -p'
-fi
-rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
-rmdir conf$$.dir 2>/dev/null
-
-if mkdir -p . 2>/dev/null; then
-  as_mkdir_p=:
-else
-  test -d ./-p && rmdir ./-p
-  as_mkdir_p=false
-fi
-
-# Find out whether ``test -x'' works.  Don't use a zero-byte file, as
-# systems may use methods other than mode bits to determine executability.
-cat >conf$$.file <<_ASEOF
-#! /bin/sh
-exit 0
-_ASEOF
-chmod +x conf$$.file
-if test -x conf$$.file >/dev/null 2>&1; then
-  as_executable_p="test -x"
-else
-  as_executable_p=:
-fi
-rm -f conf$$.file
-
-# Sed expression to map a string onto a valid CPP name.
-as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
-
-# Sed expression to map a string onto a valid variable name.
-as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
-
-
-exec 6>&1
-
-# Save the log message, to keep $[0] and so on meaningful, and to
-# report actual input values of CONFIG_FILES etc. instead of their
-# values after options handling.
-ac_log="
-This file was extended by smartmontools $as_me 5.37, which was
-generated by GNU Autoconf 2.60.  Invocation command line was
-
-  CONFIG_FILES    = $CONFIG_FILES
-  CONFIG_HEADERS  = $CONFIG_HEADERS
-  CONFIG_LINKS    = $CONFIG_LINKS
-  CONFIG_COMMANDS = $CONFIG_COMMANDS
-  $ $0 $@
-
-on `(hostname || uname -n) 2>/dev/null | sed 1q`
-"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<_ACEOF
-# Files that config.status was made for.
-config_files="$ac_config_files"
-config_headers="$ac_config_headers"
-config_commands="$ac_config_commands"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-ac_cs_usage="\
-\`$as_me' instantiates files from templates according to the
-current configuration.
-
-Usage: $0 [OPTIONS] [FILE]...
-
-  -h, --help       print this help, then exit
-  -V, --version    print version number, then exit
-  -q, --quiet      do not print progress messages
-  -d, --debug      don't remove temporary files
-      --recheck    update $as_me by reconfiguring in the same conditions
-  --file=FILE[:TEMPLATE]
-                  instantiate the configuration file FILE
-  --header=FILE[:TEMPLATE]
-                  instantiate the configuration header FILE
-
-Configuration files:
-$config_files
-
-Configuration headers:
-$config_headers
-
-Configuration commands:
-$config_commands
-
-Report bugs to <bug-autoconf@gnu.org>."
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-ac_cs_version="\\
-smartmontools config.status 5.37
-configured by $0, generated by GNU Autoconf 2.60,
-  with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
-
-Copyright (C) 2006 Free Software Foundation, Inc.
-This config.status script is free software; the Free Software Foundation
-gives unlimited permission to copy, distribute and modify it."
-
-ac_pwd='$ac_pwd'
-srcdir='$srcdir'
-INSTALL='$INSTALL'
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If no file are specified by the user, then we need to provide default
-# value.  By we need to know if files were specified by the user.
-ac_need_defaults=:
-while test $# != 0
-do
-  case $1 in
-  --*=*)
-    ac_option=`expr "X$1" : 'X\([^=]*\)='`
-    ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
-    ac_shift=:
-    ;;
-  *)
-    ac_option=$1
-    ac_optarg=$2
-    ac_shift=shift
-    ;;
-  esac
-
-  case $ac_option in
-  # Handling of the options.
-  -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
-    ac_cs_recheck=: ;;
-  --version | --versio | --versi | --vers | --ver | --ve | --v | -V )
-    echo "$ac_cs_version"; exit ;;
-  --debug | --debu | --deb | --de | --d | -d )
-    debug=: ;;
-  --file | --fil | --fi | --f )
-    $ac_shift
-    CONFIG_FILES="$CONFIG_FILES $ac_optarg"
-    ac_need_defaults=false;;
-  --header | --heade | --head | --hea )
-    $ac_shift
-    CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
-    ac_need_defaults=false;;
-  --he | --h)
-    # Conflict between --help and --header
-    { echo "$as_me: error: ambiguous option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; };;
-  --help | --hel | -h )
-    echo "$ac_cs_usage"; exit ;;
-  -q | -quiet | --quiet | --quie | --qui | --qu | --q \
-  | -silent | --silent | --silen | --sile | --sil | --si | --s)
-    ac_cs_silent=: ;;
-
-  # This is an error.
-  -*) { echo "$as_me: error: unrecognized option: $1
-Try \`$0 --help' for more information." >&2
-   { (exit 1); exit 1; }; } ;;
-
-  *) ac_config_targets="$ac_config_targets $1"
-     ac_need_defaults=false ;;
-
-  esac
-  shift
-done
-
-ac_configure_extra_args=
-
-if $ac_cs_silent; then
-  exec 6>/dev/null
-  ac_configure_extra_args="$ac_configure_extra_args --silent"
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-if \$ac_cs_recheck; then
-  echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
-  CONFIG_SHELL=$SHELL
-  export CONFIG_SHELL
-  exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
-fi
-
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-exec 5>>config.log
-{
-  echo
-  sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
-## Running $as_me. ##
-_ASBOX
-  echo "$ac_log"
-} >&5
-
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-#
-# INIT-COMMANDS
-#
-AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"
-
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-
-# Handling of arguments.
-for ac_config_target in $ac_config_targets
-do
-  case $ac_config_target in
-    "config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h" ;;
-    "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;;
-    "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
-    "examplescripts/Makefile") CONFIG_FILES="$CONFIG_FILES examplescripts/Makefile" ;;
-
-  *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
-echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
-   { (exit 1); exit 1; }; };;
-  esac
-done
-
-
-# If the user did not use the arguments to specify the items to instantiate,
-# then the envvar interface is used.  Set only those that are not.
-# We use the long form for the default assignment because of an extremely
-# bizarre bug on SunOS 4.1.3.
-if $ac_need_defaults; then
-  test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
-  test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
-  test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
-fi
-
-# Have a temporary directory for convenience.  Make it in the build tree
-# simply because there is no reason against having it here, and in addition,
-# creating and moving files from /tmp can sometimes cause problems.
-# Hook for its removal unless debugging.
-# Note that there is a small window in which the directory will not be cleaned:
-# after its creation but before its name has been assigned to `$tmp'.
-$debug ||
-{
-  tmp=
-  trap 'exit_status=$?
-  { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
-' 0
-  trap '{ (exit 1); exit 1; }' 1 2 13 15
-}
-# Create a (secure) tmp directory for tmp files.
-
-{
-  tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
-  test -n "$tmp" && test -d "$tmp"
-}  ||
-{
-  tmp=./conf$$-$RANDOM
-  (umask 077 && mkdir "$tmp")
-} ||
-{
-   echo "$me: cannot create a temporary directory in ." >&2
-   { (exit 1); exit 1; }
-}
-
-#
-# Set up the sed scripts for CONFIG_FILES section.
-#
-
-# No need to generate the scripts if there are no CONFIG_FILES.
-# This happens for instance when ./config.status config.h
-if test -n "$CONFIG_FILES"; then
-
-_ACEOF
-
-
-
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-SHELL!$SHELL$ac_delim
-PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
-PACKAGE_NAME!$PACKAGE_NAME$ac_delim
-PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
-PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
-PACKAGE_STRING!$PACKAGE_STRING$ac_delim
-PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
-exec_prefix!$exec_prefix$ac_delim
-prefix!$prefix$ac_delim
-program_transform_name!$program_transform_name$ac_delim
-bindir!$bindir$ac_delim
-sbindir!$sbindir$ac_delim
-libexecdir!$libexecdir$ac_delim
-datarootdir!$datarootdir$ac_delim
-datadir!$datadir$ac_delim
-sysconfdir!$sysconfdir$ac_delim
-sharedstatedir!$sharedstatedir$ac_delim
-localstatedir!$localstatedir$ac_delim
-includedir!$includedir$ac_delim
-oldincludedir!$oldincludedir$ac_delim
-docdir!$docdir$ac_delim
-infodir!$infodir$ac_delim
-htmldir!$htmldir$ac_delim
-dvidir!$dvidir$ac_delim
-pdfdir!$pdfdir$ac_delim
-psdir!$psdir$ac_delim
-libdir!$libdir$ac_delim
-localedir!$localedir$ac_delim
-mandir!$mandir$ac_delim
-DEFS!$DEFS$ac_delim
-ECHO_C!$ECHO_C$ac_delim
-ECHO_N!$ECHO_N$ac_delim
-ECHO_T!$ECHO_T$ac_delim
-LIBS!$LIBS$ac_delim
-build_alias!$build_alias$ac_delim
-host_alias!$host_alias$ac_delim
-target_alias!$target_alias$ac_delim
-INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
-INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
-INSTALL_DATA!$INSTALL_DATA$ac_delim
-CYGPATH_W!$CYGPATH_W$ac_delim
-PACKAGE!$PACKAGE$ac_delim
-VERSION!$VERSION$ac_delim
-ACLOCAL!$ACLOCAL$ac_delim
-AUTOCONF!$AUTOCONF$ac_delim
-AUTOMAKE!$AUTOMAKE$ac_delim
-AUTOHEADER!$AUTOHEADER$ac_delim
-MAKEINFO!$MAKEINFO$ac_delim
-install_sh!$install_sh$ac_delim
-STRIP!$STRIP$ac_delim
-INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
-mkdir_p!$mkdir_p$ac_delim
-AWK!$AWK$ac_delim
-SET_MAKE!$SET_MAKE$ac_delim
-am__leading_dot!$am__leading_dot$ac_delim
-AMTAR!$AMTAR$ac_delim
-am__tar!$am__tar$ac_delim
-am__untar!$am__untar$ac_delim
-MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
-MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
-MAINT!$MAINT$ac_delim
-CXX!$CXX$ac_delim
-CXXFLAGS!$CXXFLAGS$ac_delim
-LDFLAGS!$LDFLAGS$ac_delim
-CPPFLAGS!$CPPFLAGS$ac_delim
-ac_ct_CXX!$ac_ct_CXX$ac_delim
-EXEEXT!$EXEEXT$ac_delim
-OBJEXT!$OBJEXT$ac_delim
-DEPDIR!$DEPDIR$ac_delim
-am__include!$am__include$ac_delim
-am__quote!$am__quote$ac_delim
-AMDEP_TRUE!$AMDEP_TRUE$ac_delim
-AMDEP_FALSE!$AMDEP_FALSE$ac_delim
-AMDEPBACKSLASH!$AMDEPBACKSLASH$ac_delim
-CXXDEPMODE!$CXXDEPMODE$ac_delim
-am__fastdepCXX_TRUE!$am__fastdepCXX_TRUE$ac_delim
-am__fastdepCXX_FALSE!$am__fastdepCXX_FALSE$ac_delim
-CC!$CC$ac_delim
-CFLAGS!$CFLAGS$ac_delim
-ac_ct_CC!$ac_ct_CC$ac_delim
-CCDEPMODE!$CCDEPMODE$ac_delim
-am__fastdepCC_TRUE!$am__fastdepCC_TRUE$ac_delim
-am__fastdepCC_FALSE!$am__fastdepCC_FALSE$ac_delim
-CCAS!$CCAS$ac_delim
-CCASFLAGS!$CCASFLAGS$ac_delim
-build!$build$ac_delim
-build_cpu!$build_cpu$ac_delim
-build_vendor!$build_vendor$ac_delim
-build_os!$build_os$ac_delim
-host!$host$ac_delim
-host_cpu!$host_cpu$ac_delim
-host_vendor!$host_vendor$ac_delim
-host_os!$host_os$ac_delim
-CXXCPP!$CXXCPP$ac_delim
-GREP!$GREP$ac_delim
-EGREP!$EGREP$ac_delim
-libc_have_working_snprintf!$libc_have_working_snprintf$ac_delim
-_ACEOF
-
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
-    break
-  elif $ac_last_try; then
-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-  fi
-done
-
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
-  ac_eof=`expr $ac_eof + 1`
-fi
-
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-CEOF$ac_eof
-_ACEOF
-
-
-ac_delim='%!_!# '
-for ac_last_try in false false false false false :; do
-  cat >conf$$subs.sed <<_ACEOF
-gcc_have_attr_packed!$gcc_have_attr_packed$ac_delim
-ASFLAGS!$ASFLAGS$ac_delim
-exampledir!$exampledir$ac_delim
-initddir!$initddir$ac_delim
-smartd_suffix!$smartd_suffix$ac_delim
-SMARTD_SUFFIX_TRUE!$SMARTD_SUFFIX_TRUE$ac_delim
-SMARTD_SUFFIX_FALSE!$SMARTD_SUFFIX_FALSE$ac_delim
-releaseversion!$releaseversion$ac_delim
-smartmontools_release_date!$smartmontools_release_date$ac_delim
-smartmontools_release_time!$smartmontools_release_time$ac_delim
-os_deps!$os_deps$ac_delim
-os_libs!$os_libs$ac_delim
-OS_DARWIN_TRUE!$OS_DARWIN_TRUE$ac_delim
-OS_DARWIN_FALSE!$OS_DARWIN_FALSE$ac_delim
-OS_SOLARIS_TRUE!$OS_SOLARIS_TRUE$ac_delim
-OS_SOLARIS_FALSE!$OS_SOLARIS_FALSE$ac_delim
-OS_WIN32_MINGW_TRUE!$OS_WIN32_MINGW_TRUE$ac_delim
-OS_WIN32_MINGW_FALSE!$OS_WIN32_MINGW_FALSE$ac_delim
-LIBOBJS!$LIBOBJS$ac_delim
-LTLIBOBJS!$LTLIBOBJS$ac_delim
-_ACEOF
-
-  if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 20; then
-    break
-  elif $ac_last_try; then
-    { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
-echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
-   { (exit 1); exit 1; }; }
-  else
-    ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
-  fi
-done
-
-ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
-if test -n "$ac_eof"; then
-  ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
-  ac_eof=`expr $ac_eof + 1`
-fi
-
-cat >>$CONFIG_STATUS <<_ACEOF
-cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
-_ACEOF
-sed '
-s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
-s/^/s,@/; s/!/@,|#_!!_#|/
-:n
-t n
-s/'"$ac_delim"'$/,g/; t
-s/$/\\/; p
-N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
-' >>$CONFIG_STATUS <conf$$subs.sed
-rm -f conf$$subs.sed
-cat >>$CONFIG_STATUS <<_ACEOF
-:end
-s/|#_!!_#|//g
-CEOF$ac_eof
-_ACEOF
-
-
-# VPATH may cause trouble with some makes, so we remove $(srcdir),
-# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
-  ac_vpsub='/^[         ]*VPATH[        ]*=/{
-s/:*\$(srcdir):*/:/
-s/:*\${srcdir}:*/:/
-s/:*@srcdir@:*/:/
-s/^\([^=]*=[    ]*\):*/\1/
-s/:*$//
-s/^[^=]*=[      ]*$//
-}'
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-fi # test -n "$CONFIG_FILES"
-
-
-for ac_tag in  :F $CONFIG_FILES  :H $CONFIG_HEADERS    :C $CONFIG_COMMANDS
-do
-  case $ac_tag in
-  :[FHLC]) ac_mode=$ac_tag; continue;;
-  esac
-  case $ac_mode$ac_tag in
-  :[FHL]*:*);;
-  :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
-echo "$as_me: error: Invalid tag $ac_tag." >&2;}
-   { (exit 1); exit 1; }; };;
-  :[FH]-) ac_tag=-:-;;
-  :[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
-  esac
-  ac_save_IFS=$IFS
-  IFS=:
-  set x $ac_tag
-  IFS=$ac_save_IFS
-  shift
-  ac_file=$1
-  shift
-
-  case $ac_mode in
-  :L) ac_source=$1;;
-  :[FH])
-    ac_file_inputs=
-    for ac_f
-    do
-      case $ac_f in
-      -) ac_f="$tmp/stdin";;
-      *) # Look for the file first in the build tree, then in the source tree
-        # (if the path is not absolute).  The absolute path cannot be DOS-style,
-        # because $ac_f cannot contain `:'.
-        test -f "$ac_f" ||
-          case $ac_f in
-          [\\/$]*) false;;
-          *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
-          esac ||
-          { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
-echo "$as_me: error: cannot find input file: $ac_f" >&2;}
-   { (exit 1); exit 1; }; };;
-      esac
-      ac_file_inputs="$ac_file_inputs $ac_f"
-    done
-
-    # Let's still pretend it is `configure' which instantiates (i.e., don't
-    # use $as_me), people would be surprised to read:
-    #    /* config.h.  Generated by config.status.  */
-    configure_input="Generated from "`IFS=:
-         echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
-    if test x"$ac_file" != x-; then
-      configure_input="$ac_file.  $configure_input"
-      { echo "$as_me:$LINENO: creating $ac_file" >&5
-echo "$as_me: creating $ac_file" >&6;}
-    fi
-
-    case $ac_tag in
-    *:-:* | *:-) cat >"$tmp/stdin";;
-    esac
-    ;;
-  esac
-
-  ac_dir=`$as_dirname -- "$ac_file" ||
-$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$ac_file" : 'X\(//\)[^/]' \| \
-        X"$ac_file" : 'X\(//\)$' \| \
-        X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$ac_file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-  { as_dir="$ac_dir"
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$as_dir" : 'X\(//\)[^/]' \| \
-        X"$as_dir" : 'X\(//\)$' \| \
-        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
-  ac_builddir=.
-
-case "$ac_dir" in
-.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
-*)
-  ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
-  # A ".." for each directory in $ac_dir_suffix.
-  ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
-  case $ac_top_builddir_sub in
-  "") ac_top_builddir_sub=. ac_top_build_prefix= ;;
-  *)  ac_top_build_prefix=$ac_top_builddir_sub/ ;;
-  esac ;;
-esac
-ac_abs_top_builddir=$ac_pwd
-ac_abs_builddir=$ac_pwd$ac_dir_suffix
-# for backward compatibility:
-ac_top_builddir=$ac_top_build_prefix
-
-case $srcdir in
-  .)  # We are building in place.
-    ac_srcdir=.
-    ac_top_srcdir=$ac_top_builddir_sub
-    ac_abs_top_srcdir=$ac_pwd ;;
-  [\\/]* | ?:[\\/]* )  # Absolute name.
-    ac_srcdir=$srcdir$ac_dir_suffix;
-    ac_top_srcdir=$srcdir
-    ac_abs_top_srcdir=$srcdir ;;
-  *) # Relative name.
-    ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix
-    ac_top_srcdir=$ac_top_build_prefix$srcdir
-    ac_abs_top_srcdir=$ac_pwd/$srcdir ;;
-esac
-ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
-
-
-  case $ac_mode in
-  :F)
-  #
-  # CONFIG_FILE
-  #
-
-  case $INSTALL in
-  [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
-  *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
-  esac
-_ACEOF
-
-cat >>$CONFIG_STATUS <<\_ACEOF
-# If the template does not know about datarootdir, expand it.
-# FIXME: This hack should be removed a few years after 2.60.
-ac_datarootdir_hack=; ac_datarootdir_seen=
-
-case `sed -n '/datarootdir/ {
-  p
-  q
-}
-/@datadir@/p
-/@docdir@/p
-/@infodir@/p
-/@localedir@/p
-/@mandir@/p
-' $ac_file_inputs` in
-*datarootdir*) ac_datarootdir_seen=yes;;
-*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
-  { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
-_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF
-  ac_datarootdir_hack='
-  s&@datadir@&$datadir&g
-  s&@docdir@&$docdir&g
-  s&@infodir@&$infodir&g
-  s&@localedir@&$localedir&g
-  s&@mandir@&$mandir&g
-    s&\\\${datarootdir}&$datarootdir&g' ;;
-esac
-_ACEOF
-
-# Neutralize VPATH when `$srcdir' = `.'.
-# Shell code in configure.ac might set extrasub.
-# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF
-  sed "$ac_vpsub
-$extrasub
-_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF
-:t
-/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s&@configure_input@&$configure_input&;t t
-s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@srcdir@&$ac_srcdir&;t t
-s&@abs_srcdir@&$ac_abs_srcdir&;t t
-s&@top_srcdir@&$ac_top_srcdir&;t t
-s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t
-s&@builddir@&$ac_builddir&;t t
-s&@abs_builddir@&$ac_abs_builddir&;t t
-s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
-s&@INSTALL@&$ac_INSTALL&;t t
-$ac_datarootdir_hack
-" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
-
-test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
-  { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
-  { ac_out=`sed -n '/^[         ]*datarootdir[  ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
-  { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&5
-echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined.  Please make sure it is defined." >&2;}
-
-  rm -f "$tmp/stdin"
-  case $ac_file in
-  -) cat "$tmp/out"; rm -f "$tmp/out";;
-  *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
-  esac
- ;;
-  :H)
-  #
-  # CONFIG_HEADER
-  #
-_ACEOF
-
-# Transform confdefs.h into a sed script `conftest.defines', that
-# substitutes the proper values into config.h.in to produce config.h.
-rm -f conftest.defines conftest.tail
-# First, append a space to every undef/define line, to ease matching.
-echo 's/$/ /' >conftest.defines
-# Then, protect against being on the right side of a sed subst, or in
-# an unquoted here document, in config.status.  If some macros were
-# called several times there might be several #defines for the same
-# symbol, which is useless.  But do not sort them, since the last
-# AC_DEFINE must be honored.
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
-# NAME is the cpp macro being defined, VALUE is the value it is being given.
-# PARAMS is the parameter list in the macro definition--in most cases, it's
-# just an empty string.
-ac_dA='s,^\\([  #]*\\)[^        ]*\\([  ]*'
-ac_dB='\\)[     (].*,\\1define\\2'
-ac_dC=' '
-ac_dD=' ,'
-
-uniq confdefs.h |
-  sed -n '
-       t rset
-       :rset
-       s/^[     ]*#[    ]*define[       ][      ]*//
-       t ok
-       d
-       :ok
-       s/[\\&,]/\\&/g
-       s/^\('"$ac_word_re"'\)\(([^()]*)\)[      ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
-       s/^\('"$ac_word_re"'\)[  ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
-  ' >>conftest.defines
-
-# Remove the space that was appended to ease matching.
-# Then replace #undef with comments.  This is necessary, for
-# example, in the case of _POSIX_SOURCE, which is predefined and required
-# on some systems where configure will not decide to define it.
-# (The regexp can be short, since the line contains either #define or #undef.)
-echo 's/ $//
-s,^[    #]*u.*,/* & */,' >>conftest.defines
-
-# Break up conftest.defines:
-ac_max_sed_lines=50
-
-# First sed command is:         sed -f defines.sed $ac_file_inputs >"$tmp/out1"
-# Second one is:        sed -f defines.sed "$tmp/out1" >"$tmp/out2"
-# Third one will be:    sed -f defines.sed "$tmp/out2" >"$tmp/out1"
-# et cetera.
-ac_in='$ac_file_inputs'
-ac_out='"$tmp/out1"'
-ac_nxt='"$tmp/out2"'
-
-while :
-do
-  # Write a here document:
-    cat >>$CONFIG_STATUS <<_ACEOF
-    # First, check the format of the line:
-    cat >"\$tmp/defines.sed" <<\\CEOF
-/^[     ]*#[    ]*undef[        ][      ]*$ac_word_re[  ]*\$/b def
-/^[     ]*#[    ]*define[       ][      ]*$ac_word_re[(         ]/b def
-b
-:def
-_ACEOF
-  sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
-  echo 'CEOF
-    sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
-  ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
-  sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
-  grep . conftest.tail >/dev/null || break
-  rm -f conftest.defines
-  mv conftest.tail conftest.defines
-done
-rm -f conftest.defines conftest.tail
-
-echo "ac_result=$ac_in" >>$CONFIG_STATUS
-cat >>$CONFIG_STATUS <<\_ACEOF
-  if test x"$ac_file" != x-; then
-    echo "/* $configure_input  */" >"$tmp/config.h"
-    cat "$ac_result" >>"$tmp/config.h"
-    if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
-      { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
-echo "$as_me: $ac_file is unchanged" >&6;}
-    else
-      rm -f $ac_file
-      mv "$tmp/config.h" $ac_file
-    fi
-  else
-    echo "/* $configure_input  */"
-    cat "$ac_result"
-  fi
-  rm -f "$tmp/out12"
-# Compute $ac_file's index in $config_headers.
-_am_stamp_count=1
-for _am_header in $config_headers :; do
-  case $_am_header in
-    $ac_file | $ac_file:* )
-      break ;;
-    * )
-      _am_stamp_count=`expr $_am_stamp_count + 1` ;;
-  esac
-done
-echo "timestamp for $ac_file" >`$as_dirname -- $ac_file ||
-$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X$ac_file : 'X\(//\)[^/]' \| \
-        X$ac_file : 'X\(//\)$' \| \
-        X$ac_file : 'X\(/\)' \| . 2>/dev/null ||
-echo X$ac_file |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`/stamp-h$_am_stamp_count
- ;;
-
-  :C)  { echo "$as_me:$LINENO: executing $ac_file commands" >&5
-echo "$as_me: executing $ac_file commands" >&6;}
- ;;
-  esac
-
-
-  case $ac_file$ac_mode in
-    "depfiles":C) test x"$AMDEP_TRUE" != x"" || for mf in $CONFIG_FILES; do
-  # Strip MF so we end up with the name of the file.
-  mf=`echo "$mf" | sed -e 's/:.*$//'`
-  # Check whether this is an Automake generated Makefile or not.
-  # We used to match only the files named `Makefile.in', but
-  # some people rename them; so instead we look at the file content.
-  # Grep'ing the first line is not enough: some people post-process
-  # each Makefile.in and add a new line on top of each file to say so.
-  # So let's grep whole file.
-  if grep '^#.*generated by automake' $mf > /dev/null 2>&1; then
-    dirpart=`$as_dirname -- "$mf" ||
-$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$mf" : 'X\(//\)[^/]' \| \
-        X"$mf" : 'X\(//\)$' \| \
-        X"$mf" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$mf" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-  else
-    continue
-  fi
-  # Extract the definition of DEPDIR, am__include, and am__quote
-  # from the Makefile without running `make'.
-  DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"`
-  test -z "$DEPDIR" && continue
-  am__include=`sed -n 's/^am__include = //p' < "$mf"`
-  test -z "am__include" && continue
-  am__quote=`sed -n 's/^am__quote = //p' < "$mf"`
-  # When using ansi2knr, U may be empty or an underscore; expand it
-  U=`sed -n 's/^U = //p' < "$mf"`
-  # Find all dependency output files, they are included files with
-  # $(DEPDIR) in their names.  We invoke sed twice because it is the
-  # simplest approach to changing $(DEPDIR) to its actual value in the
-  # expansion.
-  for file in `sed -n "
-    s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \
-       sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do
-    # Make sure the directory exists.
-    test -f "$dirpart/$file" && continue
-    fdir=`$as_dirname -- "$file" ||
-$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$file" : 'X\(//\)[^/]' \| \
-        X"$file" : 'X\(//\)$' \| \
-        X"$file" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$file" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-    { as_dir=$dirpart/$fdir
-  case $as_dir in #(
-  -*) as_dir=./$as_dir;;
-  esac
-  test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
-    as_dirs=
-    while :; do
-      case $as_dir in #(
-      *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
-      *) as_qdir=$as_dir;;
-      esac
-      as_dirs="'$as_qdir' $as_dirs"
-      as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
-        X"$as_dir" : 'X\(//\)[^/]' \| \
-        X"$as_dir" : 'X\(//\)$' \| \
-        X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-echo X"$as_dir" |
-    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)[^/].*/{
-           s//\1/
-           q
-         }
-         /^X\(\/\/\)$/{
-           s//\1/
-           q
-         }
-         /^X\(\/\).*/{
-           s//\1/
-           q
-         }
-         s/.*/./; q'`
-      test -d "$as_dir" && break
-    done
-    test -z "$as_dirs" || eval "mkdir $as_dirs"
-  } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
-echo "$as_me: error: cannot create directory $as_dir" >&2;}
-   { (exit 1); exit 1; }; }; }
-    # echo "creating $dirpart/$file"
-    echo '# dummy' > "$dirpart/$file"
-  done
-done
- ;;
-
-  esac
-done # for ac_tag
-
-
-{ (exit 0); exit 0; }
-_ACEOF
-chmod +x $CONFIG_STATUS
-ac_clean_files=$ac_clean_files_save
-
-
-# configure is writing to config.log, and then calls config.status.
-# config.status does its own redirection, appending to config.log.
-# Unfortunately, on DOS this fails, as config.log is still kept open
-# by configure, so config.status won't be able to write to it; its
-# output is simply discarded.  So we exec the FD to /dev/null,
-# effectively closing config.log, so it can be properly (re)opened and
-# appended to by config.status.  When coming back to configure, we
-# need to make the FD available again.
-if test "$no_create" != yes; then
-  ac_cs_success=:
-  ac_config_status_args=
-  test "$silent" = yes &&
-    ac_config_status_args="$ac_config_status_args --quiet"
-  exec 5>/dev/null
-  $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false
-  exec 5>>config.log
-  # Use ||, not &&, to avoid exiting from the if with $? = 1, which
-  # would make configure fail if this is the last instruction.
-  $ac_cs_success || { (exit 1); exit 1; }
-fi
-
-{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
-set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
-  echo $ECHO_N "(cached) $ECHO_C" >&6
-else
-  cat >conftest.make <<\_ACEOF
-SHELL = /bin/sh
-all:
-       @echo '@@@%%%=$(MAKE)=@@@%%%'
-_ACEOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-case `${MAKE-make} -f conftest.make 2>/dev/null` in
-  *@@@%%%=?*=@@@%%%*)
-    eval ac_cv_prog_make_${ac_make}_set=yes;;
-  *)
-    eval ac_cv_prog_make_${ac_make}_set=no;;
-esac
-rm -f conftest.make
-fi
-if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
-  { echo "$as_me:$LINENO: result: yes" >&5
-echo "${ECHO_T}yes" >&6; }
-  SET_MAKE=
-else
-  { echo "$as_me:$LINENO: result: no" >&5
-echo "${ECHO_T}no" >&6; }
-  SET_MAKE="MAKE=${MAKE-make}"
-fi
-
index d3cfaff5bd699ce2bd5744e2f7ff231921aabd8b..89d8800ed237ac27568312564db452a5d9cb0c4a 100644 (file)
@@ -1,13 +1,13 @@
 #
-# $Id: configure.in,v 1.122 2006/12/20 20:39:25 chrfranke Exp $
+# $Id: configure.in,v 1.127 2007/11/13 14:53:27 jhering Exp $
 #
 dnl Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.50)
-AC_INIT(smartmontools, 5.37, smartmontools-support@lists.sourceforge.net)
+AC_INIT(smartmontools, 5.38, smartmontools-support@lists.sourceforge.net)
 AC_CONFIG_SRCDIR(smartctl.cpp)
 
 smartmontools_configure_date=`date -u +"%Y/%m/%d %T %Z"`
-smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.122 2006/12/20 20:39:25 chrfranke Exp $'`
+smartmontools_cvs_tag=`echo '$Id: configure.in,v 1.127 2007/11/13 14:53:27 jhering Exp $'`
 smartmontools_release_date=2006/12/20
 smartmontools_release_time="20:37:59 UTC"
 
@@ -37,6 +37,10 @@ case "${host}" in
                CPPFLAGS="$CPPFLAGS -mno-cygwin"
                LDFLAGS="$LDFLAGS -mno-cygwin"
                CPPFLAGS="$CPPFLAGS -idirafter ${srcdir}/posix -idirafter ${srcdir}/os_win32"
+               ;;
+       *-*-freebsd*)
+               CPPFLAGS="$CPPFLAGS -I/usr/src/sys"
+               ;;
 esac
 
 dnl Checks for libraries.needed for gethostbyname (Solaris needs
@@ -59,6 +63,10 @@ AC_CHECK_HEADERS([sys/tweio.h])
 AC_CHECK_HEADERS([sys/twereg.h])
 dnl Check for FreeBSD twa include files...
 AC_CHECK_HEADERS([sys/tw_osl_ioctl.h])
+dnl Check for FreeBSD ciss include files...
+AC_CHECK_HEADERS([dev/ciss/cissio.h])
+dnl Check for Linux CCISS include file
+AC_CHECK_HEADERS([linux/cciss_ioctl.h])
 dnl This header file needed at least for SuSE LINUX
 AC_CHECK_HEADERS([linux/compiler.h])
 
@@ -129,14 +137,11 @@ AC_SUBST(smartmontools_release_time)
 
 dnl if OS not recognized, then use the os_generic modules
 case "${host}" in
-       *-*-linux-gnu*) 
-               AC_SUBST([os_deps], ['os_linux.o']) 
-               AC_SUBST([os_libs], ['']) ;;
        *-*-linux*)
-               AC_SUBST([os_deps], ['os_linux.o']) 
+               AC_SUBST([os_deps], ['os_linux.o cciss.o']) 
                AC_SUBST([os_libs], ['']) ;;
        *-*-freebsd*)
-               AC_SUBST([os_deps], ['os_freebsd.o']) 
+               AC_SUBST([os_deps], ['os_freebsd.o cciss.o']) 
                AC_SUBST([os_libs], ['-lcam']);;
        sparc-*-solaris*) 
                AC_DEFINE_UNQUOTED(DEFAULT_MAILER, "mailx", [use mailx as default mailer])
@@ -162,6 +167,10 @@ case "${host}" in
        *-*-darwin*)
                AC_SUBST([os_deps], ['os_darwin.o'])
                AC_SUBST([os_libs], ['-framework CoreFoundation -framework IOKit']) ;;
+       *-*-nto-qnx*)
+               AC_SUBST([os_deps], ['os_qnxnto.o'])
+               AC_SUBST([os_libs], ['']) ;;
+               
        *)
                AC_SUBST([os_deps], ['os_generic.o']) 
                AC_SUBST([os_libs], ['']) ;;
diff --git a/depcomp b/depcomp
deleted file mode 100755 (executable)
index 04701da..0000000
--- a/depcomp
+++ /dev/null
@@ -1,530 +0,0 @@
-#! /bin/sh
-# depcomp - compile a program generating dependencies as side-effects
-
-scriptversion=2005-07-09.11
-
-# Copyright (C) 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
-
-# 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 Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
-
-case $1 in
-  '')
-     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
-     exit 1;
-     ;;
-  -h | --h*)
-    cat <<\EOF
-Usage: depcomp [--help] [--version] PROGRAM [ARGS]
-
-Run PROGRAMS ARGS to compile a file, generating dependencies
-as side-effects.
-
-Environment variables:
-  depmode     Dependency tracking mode.
-  source      Source file read by `PROGRAMS ARGS'.
-  object      Object file output by `PROGRAMS ARGS'.
-  DEPDIR      directory where to store dependencies.
-  depfile     Dependency file to output.
-  tmpdepfile  Temporary file to use when outputing dependencies.
-  libtool     Whether libtool is used (yes/no).
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
-    exit $?
-    ;;
-  -v | --v*)
-    echo "depcomp $scriptversion"
-    exit $?
-    ;;
-esac
-
-if test -z "$depmode" || test -z "$source" || test -z "$object"; then
-  echo "depcomp: Variables source, object and depmode must be set" 1>&2
-  exit 1
-fi
-
-# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
-depfile=${depfile-`echo "$object" |
-  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
-tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
-
-rm -f "$tmpdepfile"
-
-# Some modes work just like other modes, but use different flags.  We
-# parameterize here, but still list the modes in the big case below,
-# to make depend.m4 easier to write.  Note that we *cannot* use a case
-# here, because this file can only contain one case statement.
-if test "$depmode" = hp; then
-  # HP compiler uses -M and no extra arg.
-  gccflag=-M
-  depmode=gcc
-fi
-
-if test "$depmode" = dashXmstdout; then
-   # This is just like dashmstdout with a different argument.
-   dashmflag=-xM
-   depmode=dashmstdout
-fi
-
-case "$depmode" in
-gcc3)
-## gcc 3 implements dependency tracking that does exactly what
-## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
-## it if -MD -MP comes after the -MF stuff.  Hmm.
-  "$@" -MT "$object" -MD -MP -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  mv "$tmpdepfile" "$depfile"
-  ;;
-
-gcc)
-## There are various ways to get dependency output from gcc.  Here's
-## why we pick this rather obscure method:
-## - Don't want to use -MD because we'd like the dependencies to end
-##   up in a subdir.  Having to rename by hand is ugly.
-##   (We might end up doing this anyway to support other compilers.)
-## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
-##   -MM, not -M (despite what the docs say).
-## - Using -M directly means running the compiler twice (even worse
-##   than renaming).
-  if test -z "$gccflag"; then
-    gccflag=-MD,
-  fi
-  "$@" -Wp,"$gccflag$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
-## The second -e expression handles DOS-style file names with drive letters.
-  sed -e 's/^[^:]*: / /' \
-      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
-## This next piece of magic avoids the `deleted header file' problem.
-## The problem is that when a header file which appears in a .P file
-## is deleted, the dependency causes make to die (because there is
-## typically no way to rebuild the header).  We avoid this by adding
-## dummy dependencies for each header file.  Too bad gcc doesn't do
-## this for us directly.
-  tr ' ' '
-' < "$tmpdepfile" |
-## Some versions of gcc put a space before the `:'.  On the theory
-## that the space means something, we add a space to the output as
-## well.
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-hp)
-  # This case exists only to let depend.m4 do its work.  It works by
-  # looking at the text of this script.  This case will never be run,
-  # since it is checked for above.
-  exit 1
-  ;;
-
-sgi)
-  if test "$libtool" = yes; then
-    "$@" "-Wp,-MDupdate,$tmpdepfile"
-  else
-    "$@" -MDupdate "$tmpdepfile"
-  fi
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-
-  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
-    echo "$object : \\" > "$depfile"
-
-    # Clip off the initial element (the dependent).  Don't try to be
-    # clever and replace this with sed code, as IRIX sed won't handle
-    # lines with more than a fixed number of characters (4096 in
-    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
-    # the IRIX cc adds comments like `#:fec' to the end of the
-    # dependency line.
-    tr ' ' '
-' < "$tmpdepfile" \
-    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
-    tr '
-' ' ' >> $depfile
-    echo >> $depfile
-
-    # The second pass generates a dummy entry for each header file.
-    tr ' ' '
-' < "$tmpdepfile" \
-   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
-   >> $depfile
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-aix)
-  # The C for AIX Compiler uses -M and outputs the dependencies
-  # in a .u file.  In older versions, this file always lives in the
-  # current directory.  Also, the AIX compiler puts `$object:' at the
-  # start of each line; $object doesn't have directory information.
-  # Version 6 uses the directory in both cases.
-  stripped=`echo "$object" | sed 's/\(.*\)\..*$/\1/'`
-  tmpdepfile="$stripped.u"
-  if test "$libtool" = yes; then
-    "$@" -Wc,-M
-  else
-    "$@" -M
-  fi
-  stat=$?
-
-  if test -f "$tmpdepfile"; then :
-  else
-    stripped=`echo "$stripped" | sed 's,^.*/,,'`
-    tmpdepfile="$stripped.u"
-  fi
-
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-
-  if test -f "$tmpdepfile"; then
-    outname="$stripped.o"
-    # Each line is of the form `foo.o: dependent.h'.
-    # Do two passes, one to just change these to
-    # `$object: dependent.h' and one to simply `dependent.h:'.
-    sed -e "s,^$outname:,$object :," < "$tmpdepfile" > "$depfile"
-    sed -e "s,^$outname: \(.*\)$,\1:," < "$tmpdepfile" >> "$depfile"
-  else
-    # The sourcefile does not contain any dependencies, so just
-    # store a dummy comment line, to avoid errors with the Makefile
-    # "include basename.Plo" scheme.
-    echo "#dummy" > "$depfile"
-  fi
-  rm -f "$tmpdepfile"
-  ;;
-
-icc)
-  # Intel's C compiler understands `-MD -MF file'.  However on
-  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
-  # ICC 7.0 will fill foo.d with something like
-  #    foo.o: sub/foo.c
-  #    foo.o: sub/foo.h
-  # which is wrong.  We want:
-  #    sub/foo.o: sub/foo.c
-  #    sub/foo.o: sub/foo.h
-  #    sub/foo.c:
-  #    sub/foo.h:
-  # ICC 7.1 will output
-  #    foo.o: sub/foo.c sub/foo.h
-  # and will wrap long lines using \ :
-  #    foo.o: sub/foo.c ... \
-  #     sub/foo.h ... \
-  #     ...
-
-  "$@" -MD -MF "$tmpdepfile"
-  stat=$?
-  if test $stat -eq 0; then :
-  else
-    rm -f "$tmpdepfile"
-    exit $stat
-  fi
-  rm -f "$depfile"
-  # Each line is of the form `foo.o: dependent.h',
-  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
-  # Do two passes, one to just change these to
-  # `$object: dependent.h' and one to simply `dependent.h:'.
-  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
-  # Some versions of the HPUX 10.20 sed can't process this invocation
-  # correctly.  Breaking it into two sed invocations is a workaround.
-  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
-    sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-tru64)
-   # The Tru64 compiler uses -MD to generate dependencies as a side
-   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
-   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
-   # dependencies in `foo.d' instead, so we check for that too.
-   # Subdirectories are respected.
-   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
-   test "x$dir" = "x$object" && dir=
-   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
-
-   if test "$libtool" = yes; then
-      # With Tru64 cc, shared objects can also be used to make a
-      # static library.  This mecanism is used in libtool 1.4 series to
-      # handle both shared and static libraries in a single compilation.
-      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
-      #
-      # With libtool 1.5 this exception was removed, and libtool now
-      # generates 2 separate objects for the 2 libraries.  These two
-      # compilations output dependencies in in $dir.libs/$base.o.d and
-      # in $dir$base.o.d.  We have to check for both files, because
-      # one of the two compilations can be disabled.  We should prefer
-      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
-      # automatically cleaned when .libs/ is deleted, while ignoring
-      # the former would cause a distcleancheck panic.
-      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
-      tmpdepfile2=$dir$base.o.d          # libtool 1.5
-      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
-      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
-      "$@" -Wc,-MD
-   else
-      tmpdepfile1=$dir$base.o.d
-      tmpdepfile2=$dir$base.d
-      tmpdepfile3=$dir$base.d
-      tmpdepfile4=$dir$base.d
-      "$@" -MD
-   fi
-
-   stat=$?
-   if test $stat -eq 0; then :
-   else
-      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-      exit $stat
-   fi
-
-   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
-   do
-     test -f "$tmpdepfile" && break
-   done
-   if test -f "$tmpdepfile"; then
-      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
-      # That's a tab and a space in the [].
-      sed -e 's,^.*\.[a-z]*:[   ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
-   else
-      echo "#dummy" > "$depfile"
-   fi
-   rm -f "$tmpdepfile"
-   ;;
-
-#nosideeffect)
-  # This comment above is used by automake to tell side-effect
-  # dependency tracking mechanisms from slower ones.
-
-dashmstdout)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  test -z "$dashmflag" && dashmflag=-M
-  # Require at least two characters before searching for `:'
-  # in the target name.  This is to cope with DOS-style filenames:
-  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
-  "$@" $dashmflag |
-    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  tr ' ' '
-' < "$tmpdepfile" | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-dashXmstdout)
-  # This case only exists to satisfy depend.m4.  It is never actually
-  # run, as this mode is specially recognized in the preamble.
-  exit 1
-  ;;
-
-makedepend)
-  "$@" || exit $?
-  # Remove any Libtool call
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-  # X makedepend
-  shift
-  cleared=no
-  for arg in "$@"; do
-    case $cleared in
-    no)
-      set ""; shift
-      cleared=yes ;;
-    esac
-    case "$arg" in
-    -D*|-I*)
-      set fnord "$@" "$arg"; shift ;;
-    # Strip any option that makedepend may not understand.  Remove
-    # the object too, otherwise makedepend will parse it as a source file.
-    -*|$object)
-      ;;
-    *)
-      set fnord "$@" "$arg"; shift ;;
-    esac
-  done
-  obj_suffix="`echo $object | sed 's/^.*\././'`"
-  touch "$tmpdepfile"
-  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
-  rm -f "$depfile"
-  cat < "$tmpdepfile" > "$depfile"
-  sed '1,2d' "$tmpdepfile" | tr ' ' '
-' | \
-## Some versions of the HPUX 10.20 sed can't process this invocation
-## correctly.  Breaking it into two sed invocations is a workaround.
-    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile" "$tmpdepfile".bak
-  ;;
-
-cpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout.
-  "$@" || exit $?
-
-  # Remove the call to Libtool.
-  if test "$libtool" = yes; then
-    while test $1 != '--mode=compile'; do
-      shift
-    done
-    shift
-  fi
-
-  # Remove `-o $object'.
-  IFS=" "
-  for arg
-  do
-    case $arg in
-    -o)
-      shift
-      ;;
-    $object)
-      shift
-      ;;
-    *)
-      set fnord "$@" "$arg"
-      shift # fnord
-      shift # $arg
-      ;;
-    esac
-  done
-
-  "$@" -E |
-    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
-       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
-    sed '$ s: \\$::' > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  cat < "$tmpdepfile" >> "$depfile"
-  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-msvisualcpp)
-  # Important note: in order to support this mode, a compiler *must*
-  # always write the preprocessed file to stdout, regardless of -o,
-  # because we must use -o when running libtool.
-  "$@" || exit $?
-  IFS=" "
-  for arg
-  do
-    case "$arg" in
-    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
-       set fnord "$@"
-       shift
-       shift
-       ;;
-    *)
-       set fnord "$@" "$arg"
-       shift
-       shift
-       ;;
-    esac
-  done
-  "$@" -E |
-  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::echo "`cygpath -u \\"\1\\"`":p' | sort | uniq > "$tmpdepfile"
-  rm -f "$depfile"
-  echo "$object : \\" > "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::   \1 \\:p' >> "$depfile"
-  echo "       " >> "$depfile"
-  . "$tmpdepfile" | sed 's% %\\ %g' | sed -n '/^\(.*\)$/ s::\1\::p' >> "$depfile"
-  rm -f "$tmpdepfile"
-  ;;
-
-none)
-  exec "$@"
-  ;;
-
-*)
-  echo "Unknown depmode $depmode" 1>&2
-  exit 1
-  ;;
-esac
-
-exit 0
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
diff --git a/do_release b/do_release
new file mode 100755 (executable)
index 0000000..ece3702
--- /dev/null
@@ -0,0 +1,98 @@
+#!/bin/bash -ev
+#
+# do a smartmontools release
+# (C) 2003-6 Bruce Allen <ballen4705@users.sourceforge.net>, 
+#          Guido Guenther <agx@sigxcpu.org>
+# $Id: do_release,v 1.40 2006/12/19 19:25:42 chrfranke Exp $
+
+# Notes on generating releases:
+# (1) update NEWS
+# (2) update CHANGELOG -- put in release number
+# (3) update release number in configure.in and smartmontools.spec
+# (4) update internal changelog in smartmontools.spec
+# (5) to test, set USECVS below to 0
+# (6) when satisfied, set USECVS below to 1
+
+USECVS=1
+
+KEYID=0x841ABAE8
+
+setup_cvs()
+{
+  CVS_SERVER=fakevalue
+  unset CVS_SERVER || echo "can't unset CVS_SERVER=$CVS_SERVER"
+  CVS_RSH=ssh
+  CVSROOT=:ext:ballen4705@smartmontools.cvs.sourceforge.net:/cvsroot/smartmontools
+}
+
+get_release()
+{
+  VERSION=`grep 'AC_INIT' configure.in | awk '{ print $2 }' | sed s/,//g`
+  RELEASE="RELEASE_${VERSION//\./_}"
+  echo "Version: $VERSION"
+  echo "Release: $RELEASE"
+}
+
+inc_release()
+{
+  MINOR=`echo $VERSION | cut -d. -f2`
+  MAJOR=`echo $VERSION | cut -d. -f1`
+  PERL_OLD=$MAJOR\\.$MINOR
+  ((MINOR++))
+  NEW_VERSION=$MAJOR.$MINOR
+  PERL_NEW=$MAJOR\\.$MINOR     
+  NEW_RELEASE="RELEASE_${NEW_VERSION//\./_}"
+  echo "New Version: $NEW_VERSION"
+  echo "New Release: $NEW_RELEASE"
+}
+
+# run automake/autoconf
+if [ -f Makefile ] ; then
+  make distcheck || exit 1
+  make clean
+  make distclean
+  rm -f Makefile configure
+fi
+
+smartmontools_release_date=`date -u +"%Y/%m/%d"`
+smartmontools_release_time=`date -u +"%T %Z"`
+cat configure.in  | sed "s|smartmontools_release_date=.*|smartmontools_release_date=${smartmontools_release_date}|" > configure.tmp
+cat configure.tmp | sed "s|smartmontools_release_time=.*|smartmontools_release_time=\"${smartmontools_release_time}\"|" > configure.in
+rm -f configure.tmp
+
+./autogen.sh
+
+get_release
+
+# tag CVS version
+if [ $USECVS -ne 0 ] ; then
+    setup_cvs
+    cvs commit -m "Release $VERSION $RELEASE"
+    cvs tag -d $RELEASE 
+    cvs tag $RELEASE
+fi
+
+# build .tar.gz
+rm -rf build
+mkdir build
+cd build
+../configure
+make distcheck || exit 1
+cd ..
+
+# increase release number:
+inc_release
+if [ $USECVS -ne 0 ] ; then
+    perl -p -i.bak -e "s/$PERL_OLD/$PERL_NEW/" configure.in
+    perl -p -i.bak -e "s/Version:\t$PERL_OLD/Version:\t$PERL_NEW/" smartmontools.spec
+fi
+
+cp -f build/smartmontools-$VERSION.tar.gz .
+if [ "$KEYID" ]; then
+  gpg --default-key $KEYID --armor --detach-sign ./smartmontools-$VERSION.tar.gz
+fi
+
+# cleanup
+rm -rf autom4te.cache build/ config.h.in Makefile.in examplescripts/Makefile.in \
+       depcomp mkinstalldirs install-sh configure config.guess config.sub \
+       aclocal.m4 missing *.bak
diff --git a/examplescripts/.cvsignore b/examplescripts/.cvsignore
new file mode 100644 (file)
index 0000000..282522d
--- /dev/null
@@ -0,0 +1,2 @@
+Makefile
+Makefile.in
index e73b760cce10e2d48bb6a69cd038058ecd3bb856..d01e961895b46b3de16a6a87c4ae1db41c4f7698 100644 (file)
@@ -37,7 +37,6 @@ PRE_UNINSTALL = :
 POST_UNINSTALL = :
 build_triplet = @build@
 host_triplet = @host@
-LIBOBJDIR =
 subdir = examplescripts
 DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
 ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
index 2a53aa33d82efd8b61df981a283dfb441539d264..97e3bcfd32c5de223355f79709490fb6f36de508 100644 (file)
--- a/extern.h
+++ b/extern.h
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
 #ifndef EXTERN_H_
 #define EXTERN_H_
 
-#define EXTERN_H_CVSID "$Id: extern.h,v 1.47 2006/09/15 08:03:52 sxzzsf Exp $\n"
+#define EXTERN_H_CVSID "$Id: extern.h,v 1.53 2007/07/21 20:59:41 chrfranke Exp $\n"
 
-// Possible values for fixfirmwarebug.  If use has NOT specified -F at
+// Possible values for fixfirmwarebug.  If user has NOT specified -F at
 // all, then value is 0.
 #define FIX_NOTSPECIFIED     0
 #define FIX_NONE             1
 #define FIX_SAMSUNG          2
 #define FIX_SAMSUNG2         3
+#define FIX_SAMSUNG3         4
 
 // Block used for global control/communications.  If you need more
 // global variables, this should be the only place that you need to
 typedef struct smartmonctrl_s {
   // spans for selective self-test
   uint64_t smartselectivespan[5][2];
+  // mode for each span, see SEL_* in utility.h
+  char smartselectivemode[5];
   // number of spans
   int smartselectivenumspans;
   int           testcase;
+  unsigned      scttempint;
   // one plus time in minutes to wait after powerup before restarting
   // interrupted offline scan after selective self-test.
   int  pendingtime;
@@ -61,6 +65,9 @@ typedef struct smartmonctrl_s {
   unsigned char selectivetestlog;
   unsigned char smarterrorlog;
   unsigned char smartbackgroundlog;
+  unsigned char scttempsts;
+  unsigned char scttemphist;
+  unsigned char scttempintp;
   unsigned char smartdisable;
   unsigned char smartenable; 
   unsigned char smartstatus;
@@ -80,6 +87,7 @@ typedef struct smartmonctrl_s {
   unsigned char smartautosavedisable;
   unsigned char printing_switchable;
   unsigned char dont_print;
+  unsigned char dont_print_serial;
   unsigned char permissive;
   unsigned char conservative;
   unsigned char checksumfail;
@@ -87,6 +95,7 @@ typedef struct smartmonctrl_s {
   unsigned char reportataioctl;
   unsigned char reportscsiioctl;
   unsigned char fixfirmwarebug;
+  unsigned char fixswappedid;
   unsigned char satpassthrulen;
   // Controller type (device type) has been specified explicitly
   unsigned char controller_explicit;
diff --git a/install-sh b/install-sh
deleted file mode 100755 (executable)
index 4d4a951..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-#!/bin/sh
-# install - install a program, script, or datafile
-
-scriptversion=2005-05-14.22
-
-# This originates from X11R5 (mit/util/scripts/install.sh), which was
-# later released in X11R6 (xc/config/util/install.sh) with the
-# following copyright and license.
-#
-# Copyright (C) 1994 X Consortium
-#
-# Permission is hereby granted, free of charge, to any person obtaining a copy
-# of this software and associated documentation files (the "Software"), to
-# deal in the Software without restriction, including without limitation the
-# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
-# sell copies of the Software, and to permit persons to whom the Software is
-# furnished to do so, subject to the following conditions:
-#
-# The above copyright notice and this permission notice shall be included in
-# all copies or substantial portions of the Software.
-#
-# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
-# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
-# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-#
-# Except as contained in this notice, the name of the X Consortium shall not
-# be used in advertising or otherwise to promote the sale, use or other deal-
-# ings in this Software without prior written authorization from the X Consor-
-# tium.
-#
-#
-# FSF changes to this file are in the public domain.
-#
-# Calling this script install-sh is preferred over install.sh, to prevent
-# `make' implicit rules from creating a file called install from it
-# when there is no Makefile.
-#
-# This script is compatible with the BSD install script, but was written
-# from scratch.  It can only install one file at a time, a restriction
-# shared with many OS's install programs.
-
-# set DOITPROG to echo to test this script
-
-# Don't use :- since 4.3BSD and earlier shells don't like it.
-doit="${DOITPROG-}"
-
-# put in absolute paths if you don't have them in your path; or use env. vars.
-
-mvprog="${MVPROG-mv}"
-cpprog="${CPPROG-cp}"
-chmodprog="${CHMODPROG-chmod}"
-chownprog="${CHOWNPROG-chown}"
-chgrpprog="${CHGRPPROG-chgrp}"
-stripprog="${STRIPPROG-strip}"
-rmprog="${RMPROG-rm}"
-mkdirprog="${MKDIRPROG-mkdir}"
-
-chmodcmd="$chmodprog 0755"
-chowncmd=
-chgrpcmd=
-stripcmd=
-rmcmd="$rmprog -f"
-mvcmd="$mvprog"
-src=
-dst=
-dir_arg=
-dstarg=
-no_target_directory=
-
-usage="Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
-   or: $0 [OPTION]... SRCFILES... DIRECTORY
-   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
-   or: $0 [OPTION]... -d DIRECTORIES...
-
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
-
-Options:
--c         (ignored)
--d         create directories instead of installing files.
--g GROUP   $chgrpprog installed files to GROUP.
--m MODE    $chmodprog installed files to MODE.
--o USER    $chownprog installed files to USER.
--s         $stripprog installed files.
--t DIRECTORY  install into DIRECTORY.
--T         report an error if DSTFILE is a directory.
---help     display this help and exit.
---version  display version info and exit.
-
-Environment variables override the default commands:
-  CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
-"
-
-while test -n "$1"; do
-  case $1 in
-    -c) shift
-        continue;;
-
-    -d) dir_arg=true
-        shift
-        continue;;
-
-    -g) chgrpcmd="$chgrpprog $2"
-        shift
-        shift
-        continue;;
-
-    --help) echo "$usage"; exit $?;;
-
-    -m) chmodcmd="$chmodprog $2"
-        shift
-        shift
-        continue;;
-
-    -o) chowncmd="$chownprog $2"
-        shift
-        shift
-        continue;;
-
-    -s) stripcmd=$stripprog
-        shift
-        continue;;
-
-    -t) dstarg=$2
-       shift
-       shift
-       continue;;
-
-    -T) no_target_directory=true
-       shift
-       continue;;
-
-    --version) echo "$0 $scriptversion"; exit $?;;
-
-    *)  # When -d is used, all remaining arguments are directories to create.
-       # When -t is used, the destination is already specified.
-       test -n "$dir_arg$dstarg" && break
-        # Otherwise, the last argument is the destination.  Remove it from $@.
-       for arg
-       do
-          if test -n "$dstarg"; then
-           # $@ is not empty: it contains at least $arg.
-           set fnord "$@" "$dstarg"
-           shift # fnord
-         fi
-         shift # arg
-         dstarg=$arg
-       done
-       break;;
-  esac
-done
-
-if test -z "$1"; then
-  if test -z "$dir_arg"; then
-    echo "$0: no input file specified." >&2
-    exit 1
-  fi
-  # It's OK to call `install-sh -d' without argument.
-  # This can happen when creating conditional directories.
-  exit 0
-fi
-
-for src
-do
-  # Protect names starting with `-'.
-  case $src in
-    -*) src=./$src ;;
-  esac
-
-  if test -n "$dir_arg"; then
-    dst=$src
-    src=
-
-    if test -d "$dst"; then
-      mkdircmd=:
-      chmodcmd=
-    else
-      mkdircmd=$mkdirprog
-    fi
-  else
-    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
-    # might cause directories to be created, which would be especially bad
-    # if $src (and thus $dsttmp) contains '*'.
-    if test ! -f "$src" && test ! -d "$src"; then
-      echo "$0: $src does not exist." >&2
-      exit 1
-    fi
-
-    if test -z "$dstarg"; then
-      echo "$0: no destination specified." >&2
-      exit 1
-    fi
-
-    dst=$dstarg
-    # Protect names starting with `-'.
-    case $dst in
-      -*) dst=./$dst ;;
-    esac
-
-    # If destination is a directory, append the input filename; won't work
-    # if double slashes aren't ignored.
-    if test -d "$dst"; then
-      if test -n "$no_target_directory"; then
-       echo "$0: $dstarg: Is a directory" >&2
-       exit 1
-      fi
-      dst=$dst/`basename "$src"`
-    fi
-  fi
-
-  # This sed command emulates the dirname command.
-  dstdir=`echo "$dst" | sed -e 's,/*$,,;s,[^/]*$,,;s,/*$,,;s,^$,.,'`
-
-  # Make sure that the destination directory exists.
-
-  # Skip lots of stat calls in the usual case.
-  if test ! -d "$dstdir"; then
-    defaultIFS='
-        '
-    IFS="${IFS-$defaultIFS}"
-
-    oIFS=$IFS
-    # Some sh's can't handle IFS=/ for some reason.
-    IFS='%'
-    set x `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
-    shift
-    IFS=$oIFS
-
-    pathcomp=
-
-    while test $# -ne 0 ; do
-      pathcomp=$pathcomp$1
-      shift
-      if test ! -d "$pathcomp"; then
-        $mkdirprog "$pathcomp"
-       # mkdir can fail with a `File exist' error in case several
-       # install-sh are creating the directory concurrently.  This
-       # is OK.
-       test -d "$pathcomp" || exit
-      fi
-      pathcomp=$pathcomp/
-    done
-  fi
-
-  if test -n "$dir_arg"; then
-    $doit $mkdircmd "$dst" \
-      && { test -z "$chowncmd" || $doit $chowncmd "$dst"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dst"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dst"; }
-
-  else
-    dstfile=`basename "$dst"`
-
-    # Make a couple of temp file names in the proper directory.
-    dsttmp=$dstdir/_inst.$$_
-    rmtmp=$dstdir/_rm.$$_
-
-    # Trap to clean up those temp files at exit.
-    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
-    trap '(exit $?); exit' 1 2 13 15
-
-    # Copy the file name to the temp name.
-    $doit $cpprog "$src" "$dsttmp" &&
-
-    # and set any options; do chmod last to preserve setuid bits.
-    #
-    # If any of these fail, we abort the whole thing.  If we want to
-    # ignore errors from any of these, just make sure not to ignore
-    # errors from the above "$doit $cpprog $src $dsttmp" command.
-    #
-    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } \
-      && { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } \
-      && { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } \
-      && { test -z "$chmodcmd" || $doit $chmodcmd "$dsttmp"; } &&
-
-    # Now rename the file to the real destination.
-    { $doit $mvcmd -f "$dsttmp" "$dstdir/$dstfile" 2>/dev/null \
-      || {
-          # The rename failed, perhaps because mv can't rename something else
-          # to itself, or perhaps because mv is so ancient that it does not
-          # support -f.
-
-          # Now remove or move aside any old file at destination location.
-          # We try this two ways since rm can't unlink itself on some
-          # systems and the destination file might be busy for other
-          # reasons.  In this case, the final cleanup might fail but the new
-          # file should still install successfully.
-          {
-            if test -f "$dstdir/$dstfile"; then
-              $doit $rmcmd -f "$dstdir/$dstfile" 2>/dev/null \
-              || $doit $mvcmd -f "$dstdir/$dstfile" "$rmtmp" 2>/dev/null \
-              || {
-                echo "$0: cannot unlink or rename $dstdir/$dstfile" >&2
-                (exit 1); exit 1
-              }
-            else
-              :
-            fi
-          } &&
-
-          # Now rename the file to the real destination.
-          $doit $mvcmd "$dsttmp" "$dstdir/$dstfile"
-        }
-    }
-  fi || { (exit 1); exit 1; }
-done
-
-# The final little trick to "correctly" pass the exit status to the exit trap.
-{
-  (exit 0); exit 0
-}
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
index 4c204f631cd9cefcc8771ad4bc834e810124f65e..6018fb8df90dddb93172c6de682f0a5a40173b84 100644 (file)
@@ -4,7 +4,7 @@
  * Home page of code is: http://smartmontools.sourceforge.net
  * Address of support mailing list: smartmontools-support@lists.sourceforge.net
  *
- * Copyright (C) 2003-6 Philip Williams, Bruce Allen
+ * Copyright (C) 2003-7 Philip Williams, Bruce Allen
  *
  * 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
@@ -26,7 +26,7 @@
 #include "knowndrives.h"
 #include "utility.h" // includes <regex.h>
 
-const char *knowndrives_c_cvsid="$Id: knowndrives.cpp,v 1.156 2006/10/30 22:35:28 pjwilliams Exp $"
+const char *knowndrives_c_cvsid="$Id: knowndrives.cpp,v 1.162 2007/11/05 00:29:11 geoffk1 Exp $"
 ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID UTILITY_H_CVSID;
 
 #define MODEL_STRING_LENGTH                         40
@@ -111,11 +111,13 @@ const unsigned char vendoropts_Hitachi_DK23XX[][2] = {
 
 const char same_as_minus_F[]="Fixes byte order in some SMART data (same as -F samsung)";
 const char same_as_minus_F2[]="Fixes byte order in some SMART data (same as -F samsung2)";
+const char same_as_minus_F3[]="Fixes completed self-test reported as in progress (same as -F samsung3)";
 
 const char may_need_minus_F_disabled[] ="May need -F samsung disabled; see manual for details.";
 const char may_need_minus_F2_disabled[]="May need -F samsung2 disabled; see manual for details.";
 const char may_need_minus_F2_enabled[] ="May need -F samsung2 enabled; see manual for details.";
 const char may_need_minus_F_enabled[]  ="May need -F samsung or -F samsung2 enabled; see manual for details.";
+const char may_need_minus_F3_enabled[] ="May need -F samsung3 enabled; see manual for details.";
 
 /* Special-purpose functions for use in knowndrives[]. */
 void specialpurpose_reverse_samsung(smartmonctrl *con)
@@ -128,6 +130,11 @@ void specialpurpose_reverse_samsung2(smartmonctrl *con)
   if (con->fixfirmwarebug==FIX_NOTSPECIFIED)
     con->fixfirmwarebug = FIX_SAMSUNG2;
 }
+void specialpurpose_fix_samsung3(smartmonctrl *con)
+{
+  if (con->fixfirmwarebug==FIX_NOTSPECIFIED)
+    con->fixfirmwarebug = FIX_SAMSUNG3;
+}
 
 /* Table of settings for known drives terminated by an element containing all
  * zeros.  The drivesettings structure is described in knowndrives.h.  Note
@@ -357,19 +364,45 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { "SAMSUNG SpinPoint P120 series", // tested with SP2504C/VT100-33
-    "^SAMSUNG SP(16[01]3|2[05][01]4)[CN]$",
+  { "SAMSUNG SpinPoint T166 series", // tested with HD501LJ/CR100-10
+    "^SAMSUNG HD(080G|160H|32[01]K|403L|50[01]L)J$",
     ".*",
     NULL, NULL, NULL, NULL
   },
+  { "SAMSUNG SpinPoint P120 series", // VF100-37 firmware, tested with SP2514N/VF100-37
+    "^SAMSUNG SP(16[01]3|2[05][01]4)[CN]$",
+    "^VF100-37$",
+    NULL, NULL,
+    specialpurpose_fix_samsung3,
+    same_as_minus_F3
+  },
+  { "SAMSUNG SpinPoint P120 series", // other firmware, tested with SP2504C/VT100-33
+    "^SAMSUNG SP(16[01]3|2[05][01]4)[CN]$",
+    ".*",
+    may_need_minus_F3_enabled,
+    NULL, NULL, NULL
+  },
   { "SAMSUNG SpinPoint P80 SD series", // tested with HD160JJ/ZM100-33
     "^SAMSUNG HD(080H|120I|160J)J$",
     ".*",
     NULL, NULL, NULL, NULL
   },
-  { "SAMSUNG SpinPoint P80 series", // firmware *-26 or later, tested with SP1614C/SW100-34
+  { "SAMSUNG SpinPoint P80 series", // BH100-35 firmware, tested with SP0842N/BH100-35
     "^SAMSUNG SP(0451|08[0124]2|12[0145]3|16[0145]4)[CN]$",
-    ".*-(2[6789]|3[0-9])$",
+    "^BH100-35$",
+    NULL, NULL,
+    specialpurpose_fix_samsung3,
+    same_as_minus_F3
+  },
+  { "SAMSUNG SpinPoint P80 series", // firmware *-35 or later
+    "^SAMSUNG SP(0451|08[0124]2|12[0145]3|16[0145]4)[CN]$",
+    ".*-3[5-9]$",
+    may_need_minus_F3_enabled,
+    NULL, NULL, NULL
+  },
+  { "SAMSUNG SpinPoint P80 series", // firmware *-26...34, tested with SP1614C/SW100-34
+    "^SAMSUNG SP(0451|08[0124]2|12[0145]3|16[0145]4)[CN]$",
+    ".*-(2[6789]|3[0-4])$",
     NULL,
     vendoropts_9_halfminutes,
     NULL, NULL
@@ -739,6 +772,11 @@ const drivesettings knowndrives[] = {
     ".*",
     NULL, NULL, NULL, NULL 
   },
+  { "Hitachi Travelstar 5K160 series",
+    "^(Hitachi )?HTS5416([468]0|1[26])J9(AT|SA)00$",
+    ".*",
+    NULL, NULL, NULL, NULL 
+  },
   { "Hitachi Travelstar 7K60",
     "^HTS726060M9AT00$",
     ".*",
@@ -1308,8 +1346,8 @@ void showpresets(const struct ata_identify_device *drive){
   char model[MODEL_STRING_LENGTH+1], firmware[FIRMWARE_STRING_LENGTH+1];
 
   // get the drive's model/firmware strings
-  formatdriveidstring(model, (char *)drive->model, MODEL_STRING_LENGTH);
-  formatdriveidstring(firmware, (char *)drive->fw_rev, FIRMWARE_STRING_LENGTH);
+  format_ata_string(model, (char *)drive->model, MODEL_STRING_LENGTH);
+  format_ata_string(firmware, (char *)drive->fw_rev, FIRMWARE_STRING_LENGTH);
   
   // and search to see if they match values in the table
   if ((i = lookupdrive(model, firmware)) < 0) {
@@ -1355,8 +1393,8 @@ int applypresets(const struct ata_identify_device *drive, unsigned char **optspt
   opts=*optsptr;
   
   // get the drive's model/firmware strings
-  formatdriveidstring(model, (char *)drive->model, MODEL_STRING_LENGTH);
-  formatdriveidstring(firmware, (char *)drive->fw_rev, FIRMWARE_STRING_LENGTH);
+  format_ata_string(model, (char *)drive->model, MODEL_STRING_LENGTH);
+  format_ata_string(firmware, (char *)drive->fw_rev, FIRMWARE_STRING_LENGTH);
   
   // Look up the drive in knowndrives[].
   if ((i = lookupdrive(model, firmware)) >= 0) {
diff --git a/missing b/missing
deleted file mode 100755 (executable)
index 894e786..0000000
--- a/missing
+++ /dev/null
@@ -1,360 +0,0 @@
-#! /bin/sh
-# Common stub for a few missing GNU programs while installing.
-
-scriptversion=2005-06-08.21
-
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005
-#   Free Software Foundation, Inc.
-# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
-
-# 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 Software Foundation; either version 2, or (at your option)
-# any later version.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301, USA.
-
-# As a special exception to the GNU General Public License, if you
-# distribute this file as part of a program that contains a
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-if test $# -eq 0; then
-  echo 1>&2 "Try \`$0 --help' for more information"
-  exit 1
-fi
-
-run=:
-
-# In the cases where this matters, `missing' is being run in the
-# srcdir already.
-if test -f configure.ac; then
-  configure_ac=configure.ac
-else
-  configure_ac=configure.in
-fi
-
-msg="missing on your system"
-
-case "$1" in
---run)
-  # Try to run requested program, and just exit if it succeeds.
-  run=
-  shift
-  "$@" && exit 0
-  # Exit code 63 means version mismatch.  This often happens
-  # when the user try to use an ancient version of a tool on
-  # a file that requires a minimum version.  In this case we
-  # we should proceed has if the program had been absent, or
-  # if --run hadn't been passed.
-  if test $? = 63; then
-    run=:
-    msg="probably too old"
-  fi
-  ;;
-
-  -h|--h|--he|--hel|--help)
-    echo "\
-$0 [OPTION]... PROGRAM [ARGUMENT]...
-
-Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an
-error status if there is no known handling for PROGRAM.
-
-Options:
-  -h, --help      display this help and exit
-  -v, --version   output version information and exit
-  --run           try to run the given command, and emulate it if it fails
-
-Supported PROGRAM values:
-  aclocal      touch file \`aclocal.m4'
-  autoconf     touch file \`configure'
-  autoheader   touch file \`config.h.in'
-  automake     touch all \`Makefile.in' files
-  bison        create \`y.tab.[ch]', if possible, from existing .[ch]
-  flex         create \`lex.yy.c', if possible, from existing .c
-  help2man     touch the output file
-  lex          create \`lex.yy.c', if possible, from existing .c
-  makeinfo     touch the output file
-  tar          try tar, gnutar, gtar, then tar without non-portable flags
-  yacc         create \`y.tab.[ch]', if possible, from existing .[ch]
-
-Send bug reports to <bug-automake@gnu.org>."
-    exit $?
-    ;;
-
-  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
-    echo "missing $scriptversion (GNU Automake)"
-    exit $?
-    ;;
-
-  -*)
-    echo 1>&2 "$0: Unknown \`$1' option"
-    echo 1>&2 "Try \`$0 --help' for more information"
-    exit 1
-    ;;
-
-esac
-
-# Now exit if we have it, but it failed.  Also exit now if we
-# don't have it and --version was passed (most likely to detect
-# the program).
-case "$1" in
-  lex|yacc)
-    # Not GNU programs, they don't have --version.
-    ;;
-
-  tar)
-    if test -n "$run"; then
-       echo 1>&2 "ERROR: \`tar' requires --run"
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       exit 1
-    fi
-    ;;
-
-  *)
-    if test -z "$run" && ($1 --version) > /dev/null 2>&1; then
-       # We have it, but it failed.
-       exit 1
-    elif test "x$2" = "x--version" || test "x$2" = "x--help"; then
-       # Could not run --version or --help.  This is probably someone
-       # running `$TOOL --version' or `$TOOL --help' to check whether
-       # $TOOL exists and not knowing $TOOL uses missing.
-       exit 1
-    fi
-    ;;
-esac
-
-# If it does not exist, or fails to run (possibly an outdated version),
-# try to emulate it.
-case "$1" in
-  aclocal*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acinclude.m4' or \`${configure_ac}'.  You might want
-         to install the \`Automake' and \`Perl' packages.  Grab them from
-         any GNU archive site."
-    touch aclocal.m4
-    ;;
-
-  autoconf)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`${configure_ac}'.  You might want to install the
-         \`Autoconf' and \`GNU m4' packages.  Grab them from any GNU
-         archive site."
-    touch configure
-    ;;
-
-  autoheader)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`acconfig.h' or \`${configure_ac}'.  You might want
-         to install the \`Autoconf' and \`GNU m4' packages.  Grab them
-         from any GNU archive site."
-    files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}`
-    test -z "$files" && files="config.h"
-    touch_files=
-    for f in $files; do
-      case "$f" in
-      *:*) touch_files="$touch_files "`echo "$f" |
-                                      sed -e 's/^[^:]*://' -e 's/:.*//'`;;
-      *) touch_files="$touch_files $f.in";;
-      esac
-    done
-    touch $touch_files
-    ;;
-
-  automake*)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'.
-         You might want to install the \`Automake' and \`Perl' packages.
-         Grab them from any GNU archive site."
-    find . -type f -name Makefile.am -print |
-          sed 's/\.am$/.in/' |
-          while read f; do touch "$f"; done
-    ;;
-
-  autom4te)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, but is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.
-         You can get \`$1' as part of \`Autoconf' from any GNU
-         archive site."
-
-    file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
-    test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
-    if test -f "$file"; then
-       touch $file
-    else
-       test -z "$file" || exec >$file
-       echo "#! /bin/sh"
-       echo "# Created by GNU Automake missing as a replacement of"
-       echo "#  $ $@"
-       echo "exit 0"
-       chmod +x $file
-       exit 1
-    fi
-    ;;
-
-  bison|yacc)
-    echo 1>&2 "\
-WARNING: \`$1' $msg.  You should only need it if
-         you modified a \`.y' file.  You may need the \`Bison' package
-         in order for those modifications to take effect.  You can get
-         \`Bison' from any GNU archive site."
-    rm -f y.tab.c y.tab.h
-    if [ $# -ne 1 ]; then
-        eval LASTARG="\${$#}"
-       case "$LASTARG" in
-       *.y)
-           SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
-           if [ -f "$SRCFILE" ]; then
-                cp "$SRCFILE" y.tab.c
-           fi
-           SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
-           if [ -f "$SRCFILE" ]; then
-                cp "$SRCFILE" y.tab.h
-           fi
-         ;;
-       esac
-    fi
-    if [ ! -f y.tab.h ]; then
-       echo >y.tab.h
-    fi
-    if [ ! -f y.tab.c ]; then
-       echo 'main() { return 0; }' >y.tab.c
-    fi
-    ;;
-
-  lex|flex)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.l' file.  You may need the \`Flex' package
-         in order for those modifications to take effect.  You can get
-         \`Flex' from any GNU archive site."
-    rm -f lex.yy.c
-    if [ $# -ne 1 ]; then
-        eval LASTARG="\${$#}"
-       case "$LASTARG" in
-       *.l)
-           SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
-           if [ -f "$SRCFILE" ]; then
-                cp "$SRCFILE" lex.yy.c
-           fi
-         ;;
-       esac
-    fi
-    if [ ! -f lex.yy.c ]; then
-       echo 'main() { return 0; }' >lex.yy.c
-    fi
-    ;;
-
-  help2man)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-        you modified a dependency of a manual page.  You may need the
-        \`Help2man' package in order for those modifications to take
-        effect.  You can get \`Help2man' from any GNU archive site."
-
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-       file=`echo "$*" | sed -n 's/.*--output=\([^ ]*\).*/\1/p'`
-    fi
-    if [ -f "$file" ]; then
-       touch $file
-    else
-       test -z "$file" || exec >$file
-       echo ".ab help2man is required to generate this page"
-       exit 1
-    fi
-    ;;
-
-  makeinfo)
-    echo 1>&2 "\
-WARNING: \`$1' is $msg.  You should only need it if
-         you modified a \`.texi' or \`.texinfo' file, or any other file
-         indirectly affecting the aspect of the manual.  The spurious
-         call might also be the consequence of using a buggy \`make' (AIX,
-         DU, IRIX).  You might want to install the \`Texinfo' package or
-         the \`GNU make' package.  Grab either from any GNU archive site."
-    # The file to touch is that specified with -o ...
-    file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
-    if test -z "$file"; then
-      # ... or it is the one specified with @setfilename ...
-      infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
-      file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $infile`
-      # ... or it is derived from the source name (dir/f.texi becomes f.info)
-      test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info
-    fi
-    # If the file does not exist, the user really needs makeinfo;
-    # let's fail without touching anything.
-    test -f $file || exit 1
-    touch $file
-    ;;
-
-  tar)
-    shift
-
-    # We have already tried tar in the generic part.
-    # Look for gnutar/gtar before invocation to avoid ugly error
-    # messages.
-    if (gnutar --version > /dev/null 2>&1); then
-       gnutar "$@" && exit 0
-    fi
-    if (gtar --version > /dev/null 2>&1); then
-       gtar "$@" && exit 0
-    fi
-    firstarg="$1"
-    if shift; then
-       case "$firstarg" in
-       *o*)
-           firstarg=`echo "$firstarg" | sed s/o//`
-           tar "$firstarg" "$@" && exit 0
-           ;;
-       esac
-       case "$firstarg" in
-       *h*)
-           firstarg=`echo "$firstarg" | sed s/h//`
-           tar "$firstarg" "$@" && exit 0
-           ;;
-       esac
-    fi
-
-    echo 1>&2 "\
-WARNING: I can't seem to be able to run \`tar' with the given arguments.
-         You may want to install GNU tar or Free paxutils, or check the
-         command line arguments."
-    exit 1
-    ;;
-
-  *)
-    echo 1>&2 "\
-WARNING: \`$1' is needed, and is $msg.
-         You might have modified some files without having the
-         proper tools for further handling them.  Check the \`README' file,
-         it often tells you about the needed prerequisites for installing
-         this package.  You may also peek at any GNU archive site, in case
-         some other package would contain this missing \`$1' program."
-    exit 1
-    ;;
-esac
-
-exit 0
-
-# Local variables:
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-end: "$"
-# End:
index 867f804da9c71bad9df6f77b9cf8cdd318069338..026ddecac73e8649dfd87f2d61ab6e83f0f96a43 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2004-6 Geoffrey Keating <geoffk@geoffk.org>
+ * Copyright (C) 2004-7 Geoffrey Keating <geoffk@geoffk.org>
  *
  * 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
@@ -17,6 +17,7 @@
 
 #include <stdbool.h>
 #include <errno.h>
+#include <unistd.h>
 #include <mach/mach.h>
 #include <mach/mach_error.h>
 #include <mach/mach_init.h>
@@ -43,7 +44,7 @@
 #include "os_darwin.h"
 
 // Needed by '-V' option (CVS versioning) of smartd/smartctl
-const char *os_XXXX_c_cvsid="$Id: os_darwin.cpp,v 1.18 2006/09/20 16:17:31 shattered Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_darwin.cpp,v 1.19 2007/04/27 08:52:44 geoffk1 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_DARWIN_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 // Print examples for smartctl.
@@ -333,7 +334,7 @@ ata_command_interface(int fd, smart_command_set command,
   IOATASMARTInterface **ifp = devices[fd].smartIf;
   IOATASMARTInterface *smartIf;
   IOReturn err;
-  int timeoutCount = 2;
+  int timeoutCount = 5;
   
   if (! ifp)
     return -1;
@@ -385,8 +386,9 @@ ata_command_interface(int fd, smart_command_set command,
        {
          UInt32 dummy;
          err = smartIf->GetATAIdentifyData (ifp, data, 512, &dummy);
-         if (err != kIOReturnSuccess)
-           printf ("identify failed: %d\n", (int) err);
+         if (err != kIOReturnSuccess && err != kIOReturnTimeout
+             && err != kIOReturnNotResponding)
+           printf ("identify failed: %#x\n", (unsigned) err);
          if (err == kIOReturnSuccess && isbigendian())
            {
              int i;
@@ -409,7 +411,10 @@ ata_command_interface(int fd, smart_command_set command,
        you get a timeout, you have to try again to get the actual
        command run, but the drive is already powering up so you can't
        use this for CHECK_POWER_MODE.  */
-  } while (err == kIOReturnTimeout && timeoutCount-- > 0);
+    if (err == kIOReturnTimeout || err == kIOReturnNotResponding)
+      sleep (1);
+  } while ((err == kIOReturnTimeout || err == kIOReturnNotResponding)
+          && timeoutCount-- > 0);
   if (err == kIOReturnExclusiveAccess)
     errno = EBUSY;
   return err == kIOReturnSuccess ? 0 : -1;
index 115d70495b8b0c4bfa3ce417e65f45e2605ccbef..4a19ce0f334173aac52938456db9b0a3b097785a 100644 (file)
 #ifndef OS_DARWIN_H_
 #define OS_DARWIN_H_
 
-#define OS_DARWIN_H_CVSID "$Id: os_darwin.h,v 1.5 2006/04/12 14:54:28 ballen4705 Exp $\n"
+#define OS_DARWIN_H_CVSID "$Id: os_darwin.h,v 1.6 2007/04/16 17:49:02 shattered Exp $\n"
 
-// There isn't actually any content here yet.
+// Isn't in 10.3.9?
+
+#ifndef kIOPropertySMARTCapableKey
+#define kIOPropertySMARTCapableKey     "SMART Capable"
+#endif
 
 #endif /* OS_DARWIN_H_ */
old mode 100755 (executable)
new mode 100644 (file)
index 43dc2cbfdeac16cda28bfb541c907e3e7d2b81b4..9640a6a1d303d5527ea72362a5cdefadc15b9575 100644 (file)
 #include "int64.h"
 #include "atacmds.h"
 #include "scsicmds.h"
+#include "cciss.h"
 #include "utility.h"
+#include "extern.h"
 #include "os_freebsd.h"
 
-static const char *filenameandversion="$Id: os_freebsd.cpp,v 1.51 2006/09/17 03:17:53 dpgilbert Exp $";
+static const char *filenameandversion="$Id: os_freebsd.cpp,v 1.54 2007/09/06 08:48:55 ballen4705 Exp $";
 
-const char *os_XXXX_c_cvsid="$Id: os_freebsd.cpp,v 1.51 2006/09/17 03:17:53 dpgilbert Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_freebsd.cpp,v 1.54 2007/09/06 08:48:55 ballen4705 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_FREEBSD_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 // to hold onto exit code for atexit routine
 extern int exitstatus;
 
+extern smartmonctrl * con;
+
 // Private table of open devices: guaranteed zero on startup since
 // part of static data.
 struct freebsd_dev_channel *devicetable[FREEBSD_MAXDEV];
@@ -85,7 +89,7 @@ void print_smartctl_examples(){
 }
 
 // Like open().  Return positive integer handle, used by functions below only.  mode=="ATA" or "SCSI".
-int deviceopen (const char* dev, char* mode __unused) {
+int deviceopen (const char* dev, __unused char* mode) {
   struct freebsd_dev_channel *fdchan;
   int parse_ok, i;
 
@@ -157,6 +161,15 @@ int deviceopen (const char* dev, char* mode __unused) {
     }
   }
 
+  if (parse_ok == CONTROLLER_CCISS) {
+    if ((fdchan->device = open(dev,O_RDWR))<0) {
+      int myerror = errno; // preserver across free call
+      free(fdchan);
+      errno=myerror;
+      return -1;
+    }
+  }
+
   if (parse_ok == CONTROLLER_SCSI) {
     // this is really a NO-OP, as the parse takes care
     // of filling in correct details
@@ -248,13 +261,13 @@ void printwarning(int msgNo, const char* extra) {
   return;
 }
 
-
 // Interface to ATA devices.  See os_linux.c
-int marvell_command_interface(int fd __unused, smart_command_set command __unused, int select __unused, char *data __unused) {
-       return -1;
+
+int marvell_command_interface(__unused int fd, __unused smart_command_set command, __unused int select, __unused char *data) {
+  return -1;
 }
 
-int highpoint_command_interface(int fd __unused, smart_command_set command __unused, int select __unused, char *data __unused)
+int highpoint_command_interface(__unused int fd, __unused smart_command_set command, __unused int select, __unused char *data) {
 {
   return -1;
 }
@@ -439,7 +452,7 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *d
 
 
 // Interface to SCSI devices.  See os_linux.c
-int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
+int do_normal_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
 {
   struct freebsd_dev_channel* con = NULL;
   struct cam_device* cam_dev = NULL;
@@ -540,6 +553,40 @@ int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
   return 0;
 }
 
+/* Check and call the right interface. Maybe when the do_generic_scsi_cmd_io interface is better
+   we can take off this crude way of calling the right interface */
+int do_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
+{
+struct freebsd_dev_channel *fdchan;
+     switch(con->controller_type)
+     {
+         case CONTROLLER_CCISS:
+            // check that "file descriptor" is valid
+            if (isnotopen(&dev_fd,&fdchan))
+                 return -ENOTTY;
+#ifdef HAVE_DEV_CISS_CISSIO_H
+             return cciss_io_interface(fdchan->device, con->controller_port-1, iop, report);
+#else
+             {
+                 static int warned = 0;
+                 if (!warned) {
+                     pout("CCISS support is not available in this build of smartmontools,\n"
+                          "/usr/src/sys/dev/ciss/cissio.h was not available at build time.\n\n");
+                     warned = 1;
+                 }
+             }
+             errno = ENOSYS;
+             return -1;
+#endif
+             // not reached
+             break;
+         default:
+             return do_normal_scsi_cmnd_io(dev_fd, iop, report);
+             // not reached
+             break;
+     }
+}
+
 // Interface to ATA devices behind 3ware escalade RAID controller cards.  See os_linux.c
 
 #define BUFFER_LEN_678K_CHAR ( sizeof(struct twe_usercommand) ) // 520
@@ -589,8 +636,7 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
 
   // Same for (almost) all commands - but some reset below
   ata->request_id    = 0xFF;
-  ata->unit   = disknum;
-  ata->host_id = 0;
+  ata->unit          = disknum;
   ata->status        = 0;           
   ata->flags         = 0x1;
   ata->drive_head    = 0x0;
@@ -878,6 +924,7 @@ static const char * fbsd_dev_scsi_tape2 = "nsa";
 static const char * fbsd_dev_scsi_tape3 = "esa";
 static const char * fbsd_dev_twe_ctrl = "twe";
 static const char * fbsd_dev_twa_ctrl = "twa";
+static const char * fbsd_dev_cciss = "ciss";
 
 static int parse_ata_chan_dev(const char * dev_name, struct freebsd_dev_channel *chan) {
   int len;
@@ -953,6 +1000,10 @@ static int parse_ata_chan_dev(const char * dev_name, struct freebsd_dev_channel
     }
     return CONTROLLER_3WARE_678K_CHAR;
   }
+  // form /dev/ciss*
+  if (!strncmp(fbsd_dev_cciss, dev_name,
+               strlen(fbsd_dev_cciss)))
+    return CONTROLLER_CCISS;
 
   // we failed to recognize any of the forms
   return CONTROLLER_UNKNOWN;
@@ -1005,10 +1056,10 @@ int get_dev_names(char*** names, const char* prefix) {
   
   // Use glob to look for any directory entries matching the patterns
   // first call inits with first pattern match, second call appends
-  // to first list. Turn on NOCHECK for second call. This results in no
-  // error if no more matches found, however it does append the actual
-  // pattern to the list of paths....
-  if ((retglob=glob(pattern1, GLOB_ERR, NULL, &globbuf)) ||
+  // to first list. GLOB_NOCHECK results in no error if no more matches 
+  // found, however it does append the actual pattern to the list of 
+  // paths....
+  if ((retglob=glob(pattern1, GLOB_ERR|GLOB_NOCHECK, NULL, &globbuf)) ||
       (retglob=glob(pattern2, GLOB_ERR|GLOB_APPEND|GLOB_NOCHECK,NULL,&globbuf))) {
      int retval = -1;
     // glob failed
@@ -1033,7 +1084,6 @@ int get_dev_names(char*** names, const char* prefix) {
     return retval;
   }
 
-  // did we find too many paths?
   // did we find too many paths?
   lim = globbuf.gl_pathc < MAX_NUM_DEV ? globbuf.gl_pathc : MAX_NUM_DEV;
   if (lim < globbuf.gl_pathc)
@@ -1050,7 +1100,7 @@ int get_dev_names(char*** names, const char* prefix) {
   // now step through the list returned by glob.  No link checking needed
   // in FreeBSD
   for (i=0; i<globbuf.gl_pathc; i++){
-    // becuase of the NO_CHECK on second call to glob,
+    // because of the NO_CHECK in calls to glob,
     // the pattern itself will be added to path list..
     // so ignore any paths that have the ']' from pattern
     if (strchr(globbuf.gl_pathv[i],']') == NULL)
index da50231e20c577765d2a1d2dcafaa306e7d75894..1c4cdef5a5640379264c82db8c70977b59c6ff9f 100644 (file)
@@ -82,7 +82,7 @@
 #ifndef OS_FREEBSD_H_
 #define OS_FREEBSD_H_
 
-#define OS_FREEBSD_H_CVSID "$Id: os_freebsd.h,v 1.20 2006/04/12 14:54:28 ballen4705 Exp $\n"
+#define OS_FREEBSD_H_CVSID "$Id: os_freebsd.h,v 1.21 2007/09/06 08:48:55 ballen4705 Exp $\n"
 
 struct freebsd_dev_channel {
   int   channel;                // the ATA channel to work with
@@ -234,8 +234,7 @@ typedef struct
     u_int8_t   sgl_offset:3;
     u_int8_t   size;
     u_int8_t   request_id;
-    u_int8_t   unit:4;
-    u_int8_t   host_id:4;
+    u_int8_t   unit;
     u_int8_t   status;
     u_int8_t   flags;
     u_int16_t  param;
index a541e34805cafd059515e0a0b74c937913da69cc..a0cf122b244e816ee3a852aadcfc4457de62a5eb 100644 (file)
@@ -1,10 +1,10 @@
-/* 
+/*
  *  os_linux.c
- * 
+ *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2003-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
- * Copyright (C) 2003-6 Doug Gilbert <dougg@torque.net>
+ * Copyright (C) 2003-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2003-7 Doug Gilbert <dougg@torque.net>
  *
  *  Parts of this file are derived from code that was
  *
@@ -19,7 +19,7 @@
  *  Non-Copyright (C) 2000      Andre Hedrick <andre@suse.com>
  *
  * Other ars of this file are derived from code that was
- * 
+ *
  * Copyright (C) 1999-2000 Michael Cornwell <cornwell@acm.org>
  * Copyright (C) 2000 Andre Hedrick <andre@linux-ide.org>
  *
@@ -36,7 +36,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/
- * 
+ *
  */
 
 // This file contains the linux-specific IOCTL parts of
 // one for SCSI devices, and one for ATA devices behind escalade
 // controllers.
 
+#include "config.h"
+
 #include <errno.h>
 #include <fcntl.h>
 #include <glob.h>
 
-#ifdef HAVE_LINUX_COMPILER_H
-#include <linux/compiler.h>
-#endif
-
 #include <scsi/scsi_ioctl.h>
 #include <scsi/sg.h>
 #include <stdlib.h>
@@ -63,7 +61,6 @@
 #include <sys/sysmacros.h>
 #endif
 
-#include "config.h"
 #include "int64.h"
 #include "atacmds.h"
 #include "extern.h"
@@ -72,9 +69,7 @@ extern smartmonctrl * con;
 #include "scsicmds.h"
 #include "utility.h"
 #include "extern.h"
-
-#include <linux/cciss_ioctl.h>
-
+#include "cciss.h"
 
 #ifndef ENOTSUP
 #define ENOTSUP ENOSYS
@@ -84,9 +79,9 @@ typedef unsigned long long u8;
 
 #define ARGUSED(x) ((void)(x))
 
-static const char *filenameandversion="$Id: os_linux.cpp,v 1.88 2006/10/25 17:01:42 ballen4705 Exp $";
+static const char *filenameandversion="$Id: os_linux.cpp,v 1.97 2007/09/06 08:48:55 ballen4705 Exp $";
 
-const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.88 2006/10/25 17:01:42 ballen4705 Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_linux.cpp,v 1.97 2007/09/06 08:48:55 ballen4705 Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_LINUX_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 // to hold onto exit code for atexit routine
@@ -98,22 +93,6 @@ extern long long bytes;
 /* for passing global control variables */
 extern smartmonctrl *con;
 
-static int cciss_io_interface(int device, int target,
-                             struct scsi_cmnd_io * iop, int report);
-
-typedef struct _ReportLUNdata_struct
-{
-  BYTE LUNListLength[4];
-  DWORD reserved;
-  BYTE LUN[CISS_MAX_LUN][8];
-} ReportLunData_struct;
-
-/* Structure/defines of Report Physical LUNS of drive */
-#define CISS_MAX_LUN        16
-#define CISS_MAX_PHYS_LUN   1024
-#define CISS_REPORT_PHYS    0xc3
-
-
 /* This function will setup and fix device nodes for a 3ware controller. */
 #define MAJOR_STRING_LENGTH 3
 #define DEVICE_STRING_LENGTH 32
@@ -126,14 +105,14 @@ int setup_3ware_nodes(char *nodename, char *driver_name) {
   char             nodestring[NODE_STRING_LENGTH];
   struct stat      stat_buf;
   FILE             *file;
-  
+
   /* First try to open up /proc/devices */
   if (!(file = fopen("/proc/devices", "r"))) {
     pout("Error opening /proc/devices to check/create 3ware device nodes\n");
     syserror("fopen");
     return 0;  // don't fail here: user might not have /proc !
   }
-  
+
   /* Attempt to get device major number */
   while (EOF != fscanf(file, "%3s %32s", majorstring, device_name)) {
     majorstring[MAJOR_STRING_LENGTH]='\0';
@@ -144,17 +123,17 @@ int setup_3ware_nodes(char *nodename, char *driver_name) {
     }
   }
   fclose(file);
-  
+
   /* See if we found a major device number */
   if (!tw_major) {
     pout("No major number for /dev/%s listed in /proc/devices. Is the %s driver loaded?\n", nodename, driver_name);
     return 2;
   }
-  
+
   /* Now check if nodes are correct */
   for (index=0; index<16; index++) {
     sprintf(nodestring, "/dev/%s%d", nodename, index);
-          
+
     /* Try to stat the node */
     if ((stat(nodestring, &stat_buf))) {
       /* Create a new node if it doesn't exist */
@@ -164,19 +143,19 @@ int setup_3ware_nodes(char *nodename, char *driver_name) {
         return 3;
       }
     }
-    
+
     /* See if nodes major and minor numbers are correct */
     if ((tw_major != (int)(major(stat_buf.st_rdev))) ||
         (index    != (int)(minor(stat_buf.st_rdev))) ||
         (!S_ISCHR(stat_buf.st_mode))) {
-      
+
       /* Delete the old node */
       if (unlink(nodestring)) {
         pout("problem unlinking stale 3ware device node %s", nodestring);
         syserror("unlink");
         return 4;
       }
-      
+
       /* Make a new node */
       if (mknod(nodestring, S_IFCHR|0600, makedev(tw_major, index))) {
         pout("problem creating 3ware device nodes %s", nodestring);
@@ -196,7 +175,7 @@ int deviceopen(const char *pathname, char *type){
       fd = open(pathname, O_RDONLY | O_NONBLOCK);
     return fd;
   }
-  else if (!strcmp(type,"ATA")) 
+  else if (!strcmp(type,"ATA"))
     return open(pathname, O_RDONLY | O_NONBLOCK);
   else if (!strcmp(type,"ATA_3WARE_9000")) {
     // the device nodes for this controller are dynamically assigned,
@@ -283,23 +262,23 @@ int get_dev_names(char*** names, const char* pattern, const char* name, int max)
   int n = 0, retglob, i, lim;
   char** mp;
   glob_t globbuf;
-  
+
   memset(&globbuf, 0, sizeof(globbuf));
 
   // in case of non-clean exit
   *names=NULL;
-  
+
   // Use glob to look for any directory entries matching the pattern
   if ((retglob=glob(pattern, GLOB_ERR, NULL, &globbuf))) {
-    
+
     //  glob failed: free memory and return
     globfree(&globbuf);
-    
+
     if (retglob==GLOB_NOMATCH){
       pout("glob(3) found no matches for pattern %s\n", pattern);
       return 0;
     }
-    
+
     if (retglob==GLOB_NOSPACE)
       pout("glob(3) ran out of memory matching pattern %s\n", pattern);
 #ifdef GLOB_ABORTED // missing in old versions of glob.h
@@ -308,34 +287,34 @@ int get_dev_names(char*** names, const char* pattern, const char* name, int max)
 #endif
     else
       pout("Unexplained error in glob(3) of pattern %s\n", pattern);
-    
+
     return -1;
   }
 
   // did we find too many paths?
   lim = ((int)globbuf.gl_pathc < max) ? (int)globbuf.gl_pathc : max;
   if (lim < (int)globbuf.gl_pathc)
-    pout("glob(3) found %d > MAX=%d devices matching pattern %s: ignoring %d paths\n", 
+    pout("glob(3) found %d > MAX=%d devices matching pattern %s: ignoring %d paths\n",
          (int)globbuf.gl_pathc, max, pattern, (int)(globbuf.gl_pathc-max));
-  
+
   // allocate space for up to lim number of ATA devices
   if (!(mp =  (char **)calloc(lim, sizeof(char*)))){
     pout("Out of memory constructing scan device list\n");
     return -1;
   }
-  
+
   // now step through the list returned by glob.  If not a link, copy
   // to list.  If it is a link, evaluate it and see if the path ends
   // in "disc".
   for (i=0; i<lim; i++){
     int retlink;
-    
+
     // prepare a buffer for storing the link
     char linkbuf[1024];
-    
+
     // see if path is a link
     retlink=readlink(globbuf.gl_pathv[i], linkbuf, 1023);
-    
+
     // if not a link (or a strange link), keep it
     if (retlink<=0 || retlink>1023)
       mp[n++] = CustomStrDup(globbuf.gl_pathv[i], 1, __LINE__, filenameandversion);
@@ -363,12 +342,12 @@ int get_dev_names(char*** names, const char* pattern, const char* name, int max)
       }
     }
   }
-  
+
   // free memory, track memory usage
   globfree(&globbuf);
   mp = static_cast<char **>(realloc(mp,n*(sizeof(char*))));
   bytes += n*(sizeof(char*));
-  
+
   // and set up return values
   *names=mp;
   return n;
@@ -379,12 +358,12 @@ int get_dev_names(char*** names, const char* pattern, const char* name, int max)
 // devices on the list, which can be >=0.
 int make_device_names (char*** devlist, const char* name) {
   int retval, maxdev;
-  
+
 #if 0
   // for testing case where no device names are found
   return 0;
 #endif
-  
+
   if (!strcmp(name,"SCSI"))
     retval=get_dev_names(devlist,"/dev/sd[a-z]", name, maxdev=26);
   else if (!strcmp(name,"ATA"))
@@ -396,7 +375,7 @@ int make_device_names (char*** devlist, const char* name) {
   // if we found traditional links, we are done
   if (retval>0)
     return retval;
-  
+
   // else look for devfs entries without traditional links
   return get_dev_names(devlist,"/dev/discs/disc*", name, maxdev);
 }
@@ -417,20 +396,16 @@ int make_device_names (char*** devlist, const char* name) {
 // RETURN VALUES
 //  -1 if the command failed
 //   0 if the command succeeded,
-//   STATUS_CHECK routine: 
+//   STATUS_CHECK routine:
 //  -1 if the command failed
 //   0 if the command succeeded and disk SMART status is "OK"
 //   1 if the command succeeded and disk SMART status is "FAILING"
 
 
-// huge value of buffer size needed because HDIO_DRIVE_CMD assumes
-// that buff[3] is the data size.  Since the ATA_SMART_AUTOSAVE and
-// ATA_SMART_AUTO_OFFLINE use values of 0xf1 and 0xf8 we need the space.
-// Otherwise a 4+512 byte buffer would be enough.
-#define STRANGE_BUFFER_LENGTH (4+512*0xf8)
+#define BUFFER_LENGTH (4+512)
 
 int ata_command_interface(int device, smart_command_set command, int select, char *data){
-  unsigned char buff[STRANGE_BUFFER_LENGTH];
+  unsigned char buff[BUFFER_LENGTH];
   // positive: bytes to write to caller.  negative: bytes to READ from
   // caller. zero: non-data command
   int copydata=0;
@@ -445,9 +420,9 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
 
   // Note that on return:
   // buff[2] contains the ATA SECTOR COUNT REGISTER
-  
+
   // clear out buff.  Large enough for HDIO_DRIVE_CMD (4+512 bytes)
-  memset(buff, 0, STRANGE_BUFFER_LENGTH);
+  memset(buff, 0, BUFFER_LENGTH);
 
   buff[0]=ATA_SMART_CMD;
   switch (command){
@@ -497,12 +472,14 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
     buff[2]=ATA_SMART_STATUS;
     break;
   case AUTO_OFFLINE:
-    buff[2]=ATA_SMART_AUTO_OFFLINE;
-    buff[3]=select;   // YET NOTE - THIS IS A NON-DATA COMMAND!!
+    // NSECT is 241 for enable but no data transfer.  Use TASK ioctl.
+    buff[1]=ATA_SMART_AUTO_OFFLINE;
+    buff[2]=select;
     break;
   case AUTOSAVE:
-    buff[2]=ATA_SMART_AUTOSAVE;
-    buff[3]=select;   // YET NOTE - THIS IS A NON-DATA COMMAND!!
+    // NSECT is 248 for enable but no data transfer.  Use TASK ioctl.
+    buff[1]=ATA_SMART_AUTOSAVE;
+    buff[2]=select;
     break;
   case IMMEDIATE_OFFLINE:
     buff[2]=ATA_SMART_IMMEDIATE_OFFLINE;
@@ -519,17 +496,17 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
     errno=ENOSYS;
     return -1;
   }
-  
+
   // This command uses the HDIO_DRIVE_TASKFILE ioctl(). This is the
   // only ioctl() that can be used to WRITE data to the disk.
-  if (command==WRITE_LOG) {    
+  if (command==WRITE_LOG) {
     unsigned char task[sizeof(ide_task_request_t)+512];
     ide_task_request_t *reqtask=(ide_task_request_t *) task;
     task_struct_t      *taskfile=(task_struct_t *) reqtask->io_ports;
     int retval;
 
     memset(task,      0, sizeof(task));
-    
+
     taskfile->data           = 0;
     taskfile->feature        = ATA_SMART_WRITE_LOG_SECTOR;
     taskfile->sector_count   = 1;
@@ -538,15 +515,15 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
     taskfile->high_cylinder  = 0xc2;
     taskfile->device_head    = 0;
     taskfile->command        = ATA_SMART_CMD;
-    
+
     reqtask->data_phase      = TASKFILE_OUT;
     reqtask->req_cmd         = IDE_DRIVE_TASK_OUT;
     reqtask->out_size        = 512;
     reqtask->in_size         = 0;
-    
+
     // copy user data into the task request structure
     memcpy(task+sizeof(ide_task_request_t), data, 512);
-      
+
     if ((retval=ioctl(device, HDIO_DRIVE_TASKFILE, task))) {
       if (retval==-EINVAL)
         pout("Kernel lacks HDIO_DRIVE_TASKFILE support; compile kernel with CONFIG_IDE_TASKFILE_IO set\n");
@@ -554,10 +531,10 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
     }
     return 0;
   }
-    
+
   // There are two different types of ioctls().  The HDIO_DRIVE_TASK
   // one is this:
-  if (command==STATUS_CHECK){
+  if (command==STATUS_CHECK || command==AUTOSAVE || command==AUTO_OFFLINE){
     int retval;
 
     // NOT DOCUMENTED in /usr/src/linux/include/linux/hdreg.h. You
@@ -574,7 +551,7 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
     unsigned const char failed_lo=0xf4, failed_hi=0x2c;
     buff[4]=normal_lo;
     buff[5]=normal_hi;
-    
+
     if ((retval=ioctl(device, HDIO_DRIVE_TASK, buff))) {
       if (retval==-EINVAL) {
         pout("Error SMART Status command via HDIO_DRIVE_TASK failed");
@@ -584,29 +561,29 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
         syserror("Error SMART Status command failed");
       return -1;
     }
-    
+
     // Cyl low and Cyl high unchanged means "Good SMART status"
     if (buff[4]==normal_lo && buff[5]==normal_hi)
       return 0;
-    
+
     // These values mean "Bad SMART status"
     if (buff[4]==failed_lo && buff[5]==failed_hi)
       return 1;
-    
+
     // We haven't gotten output that makes sense; print out some debugging info
     syserror("Error SMART Status command failed");
     pout("Please get assistance from " PACKAGE_HOMEPAGE "\n");
     pout("Register values returned from SMART Status command are:\n");
-    pout("CMD=0x%02x\n",(int)buff[0]);
-    pout("FR =0x%02x\n",(int)buff[1]);
+    pout("ST =0x%02x\n",(int)buff[0]);
+    pout("ERR=0x%02x\n",(int)buff[1]);
     pout("NS =0x%02x\n",(int)buff[2]);
     pout("SC =0x%02x\n",(int)buff[3]);
     pout("CL =0x%02x\n",(int)buff[4]);
     pout("CH =0x%02x\n",(int)buff[5]);
     pout("SEL=0x%02x\n",(int)buff[6]);
-    return -1;   
+    return -1;
   }
-  
+
 #if 1
   // Note to people doing ports to other OSes -- don't worry about
   // this block -- you can safely ignore it.  I have put it here
@@ -633,7 +610,7 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
       buff[0]=(command==IDENTIFY)?ATA_IDENTIFY_PACKET_DEVICE:ATA_IDENTIFY_DEVICE;
   }
 #endif
-  
+
   // We are now doing the HDIO_DRIVE_CMD type ioctl.
   if ((ioctl(device, HDIO_DRIVE_CMD, buff)))
     return -1;
@@ -646,97 +623,9 @@ int ata_command_interface(int device, smart_command_set command, int select, cha
   // if the command returns data then copy it back
   if (copydata)
     memcpy(data, buff+HDIO_DRIVE_CMD_OFFSET, copydata);
-  
-  return 0; 
-}
-
-// CCISS Smart Array Controller
-static int cciss_sendpassthru(unsigned int cmdtype, unsigned char *CDB,
-                       unsigned int CDBlen, char *buff,
-                       unsigned int size, unsigned int LunID,
-                       unsigned char *scsi3addr, int fd)
-{
-    int err ;
-    IOCTL_Command_struct iocommand;
-
-    memset(&iocommand, 0, sizeof(iocommand));
-
-    if (cmdtype == 0) 
-    {
-        // To controller; nothing to do
-    }
-    else if (cmdtype == 1) 
-    {
-        iocommand.LUN_info.LogDev.VolId = LunID;
-        iocommand.LUN_info.LogDev.Mode = 1;
-    }
-    else if (cmdtype == 2) 
-    {
-        memcpy(&iocommand.LUN_info.LunAddrBytes,scsi3addr,8);
-        iocommand.LUN_info.LogDev.Mode = 0;
-    }
-    else 
-    {
-        fprintf(stderr, "cciss_sendpassthru: bad cmdtype\n");
-        return 1;
-    }
-
-    memcpy(&iocommand.Request.CDB[0], CDB, CDBlen);
-    iocommand.Request.CDBLen = CDBlen;
-    iocommand.Request.Type.Type = TYPE_CMD;
-    iocommand.Request.Type.Attribute = ATTR_SIMPLE;
-    iocommand.Request.Type.Direction = XFER_READ;
-    iocommand.Request.Timeout = 0;
 
-    iocommand.buf_size = size;
-    iocommand.buf = (unsigned char *)buff;
-
-    if ((err = ioctl(fd, CCISS_PASSTHRU, &iocommand))) 
-    {
-        fprintf(stderr, "CCISS ioctl error %d\n", err);
-    }
-    return err;
-}
-
-static int cciss_getlun(int device, int target, unsigned char *physlun)
-{
-    unsigned char CDB[16]= {0};
-    ReportLunData_struct *luns;
-    int reportlunsize = sizeof(*luns) + CISS_MAX_PHYS_LUN * 8;
-    int i;
-    int ret;
-
-    luns = (ReportLunData_struct *)malloc(reportlunsize);
-
-    memset(luns, 0, reportlunsize);
-
-    /* Get Physical LUN Info (for physical device) */
-    CDB[0] = CISS_REPORT_PHYS;
-    CDB[6] = (reportlunsize >> 24) & 0xFF;  /* MSB */
-    CDB[7] = (reportlunsize >> 16) & 0xFF;
-    CDB[8] = (reportlunsize >> 8) & 0xFF;
-    CDB[9] = reportlunsize & 0xFF;
-
-    if ((ret = cciss_sendpassthru(0, CDB, 12, (char *)luns, reportlunsize, 0, NULL, device)))
-    {
-        free(luns);
-        return ret;
-    }
-
-    for (i=0; i<CISS_MAX_LUN+1; i++) 
-    {
-        if (luns->LUN[i][6] == target) 
-        {
-            memcpy(physlun, luns->LUN[i], 8);
-            free(luns);
-            return 0;
-        }
-    }
-
-    free(luns);
-    return ret;
+  return 0;
 }
-// end CCISS Smart Array Controller
 
 // >>>>>> Start of general SCSI specific linux code
 
@@ -801,14 +690,14 @@ static int sg_io_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report,
         j = snprintf(buff, sz, " [%s: ", np ? np : "<unknown opcode>");
         for (k = 0; k < (int)iop->cmnd_len; ++k)
             j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "%02x ", ucp[k]);
-        if ((report > 1) && 
+        if ((report > 1) &&
             (DXFER_TO_DEVICE == iop->dxfer_dir) && (iop->dxferp)) {
             int trunc = (iop->dxfer_len > 256) ? 1 : 0;
 
             j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n  Outgoing "
                           "data, len=%d%s:\n", (int)iop->dxfer_len,
                           (trunc ? " [only first 256 bytes shown]" : ""));
-            dStrHex((const char *)iop->dxferp, 
+            dStrHex((const char *)iop->dxferp,
                     (trunc ? 256 : iop->dxfer_len) , 1);
         }
         else
@@ -849,24 +738,29 @@ static int sg_io_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report,
                  strerror(errno));
         return -errno;
     }
+    iop->resid = io_hdr.resid;
+    iop->scsi_status = io_hdr.status;
     if (report > 0) {
         pout("  scsi_status=0x%x, host_status=0x%x, driver_status=0x%x\n"
-             "  info=0x%x  duration=%d milliseconds\n", io_hdr.status, 
+             "  info=0x%x  duration=%d milliseconds  resid=%d\n", io_hdr.status,
              io_hdr.host_status, io_hdr.driver_status, io_hdr.info,
-             io_hdr.duration);
+             io_hdr.duration, io_hdr.resid);
         if (report > 1) {
             if (DXFER_FROM_DEVICE == iop->dxfer_dir) {
-                int trunc = (iop->dxfer_len > 256) ? 1 : 0;
-
-                pout("  Incoming data, len=%d%s:\n", (int)iop->dxfer_len,
-                     (trunc ? " [only first 256 bytes shown]" : ""));
-                dStrHex((const char*)iop->dxferp, 
-                        (trunc ? 256 : iop->dxfer_len) , 1);
+                int trunc, len;
+
+               len = iop->dxfer_len - iop->resid;
+               trunc = (len > 256) ? 1 : 0;
+                if (len > 0) {
+                    pout("  Incoming data, len=%d%s:\n", len,
+                         (trunc ? " [only first 256 bytes shown]" : ""));
+                    dStrHex((const char*)iop->dxferp, (trunc ? 256 : len),
+                            1);
+                } else
+                    pout("  Incoming data trimmed to nothing by resid\n");
             }
         }
     }
-    iop->resid = io_hdr.resid;
-    iop->scsi_status = io_hdr.status;
 
     if (io_hdr.info | SG_INFO_CHECK) { /* error or warning */
         int masked_driver_status = (LSCSI_DRIVER_MASK & io_hdr.driver_status);
@@ -888,7 +782,7 @@ static int sg_io_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report,
         if (LSCSI_DRIVER_SENSE == masked_driver_status)
             iop->scsi_status = SCSI_STATUS_CHECK_CONDITION;
         iop->resp_sense_len = io_hdr.sb_len_wr;
-        if ((SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) && 
+        if ((SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) &&
             iop->sensep && (iop->resp_sense_len > 0)) {
             if (report > 1) {
                 pout("  >>> Sense buffer, len=%d:\n",
@@ -922,7 +816,7 @@ struct linux_ioctl_send_command
     UINT8 buff[MAX_DXFER_LEN + 16];
 };
 
-/* The Linux SCSI_IOCTL_SEND_COMMAND ioctl is primitive and it doesn't 
+/* The Linux SCSI_IOCTL_SEND_COMMAND ioctl is primitive and it doesn't
  * support: CDB length (guesses it from opcode), resid and timeout.
  * Patches in Linux 2.4.21 and 2.5.70 to extend SEND DIAGNOSTIC timeout
  * to 2 hours in order to allow long foreground extended self tests. */
@@ -945,14 +839,14 @@ static int sisc_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
         j = snprintf(buff, sz, " [%s: ", np ? np : "<unknown opcode>");
         for (k = 0; k < (int)iop->cmnd_len; ++k)
             j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "%02x ", ucp[k]);
-        if ((report > 1) && 
+        if ((report > 1) &&
             (DXFER_TO_DEVICE == iop->dxfer_dir) && (iop->dxferp)) {
             int trunc = (iop->dxfer_len > 256) ? 1 : 0;
 
             j += snprintf(&buff[j], (sz > j ? (sz - j) : 0), "]\n  Outgoing "
                           "data, len=%d%s:\n", (int)iop->dxfer_len,
                           (trunc ? " [only first 256 bytes shown]" : ""));
-            dStrHex((const char *)iop->dxferp, 
+            dStrHex((const char *)iop->dxferp,
                     (trunc ? 256 : iop->dxfer_len) , 1);
         }
         else
@@ -1001,7 +895,7 @@ static int sisc_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
 
                 pout("  Incoming data, len=%d%s:\n", (int)iop->dxfer_len,
                      (trunc ? " [only first 256 bytes shown]" : ""));
-                dStrHex((const char*)iop->dxferp, 
+                dStrHex((const char*)iop->dxferp,
                         (trunc ? 256 : iop->dxfer_len) , 1);
             }
         }
@@ -1012,7 +906,7 @@ static int sisc_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
         iop->scsi_status = SCSI_STATUS_CHECK_CONDITION;
     len = (SEND_IOCTL_RESP_SENSE_LEN < iop->max_sense_len) ?
                 SEND_IOCTL_RESP_SENSE_LEN : iop->max_sense_len;
-    if ((SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) && 
+    if ((SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) &&
         iop->sensep && (len > 0)) {
         memcpy(iop->sensep, wrk.buff, len);
         iop->resp_sense_len = len;
@@ -1033,7 +927,7 @@ static int sisc_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
         return 0;
     else {
         if (report > 0)
-            pout("  ioctl status=0x%x but scsi status=0, fail with EIO\n", 
+            pout("  ioctl status=0x%x but scsi status=0, fail with EIO\n",
                  status);
         return -EIO;      /* give up, assume no device there */
     }
@@ -1041,7 +935,7 @@ static int sisc_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop, int report)
 
 /* SCSI command transmission interface function, linux version.
  * Returns 0 if SCSI command successfully launched and response
- * received. Even when 0 is returned the caller should check 
+ * received. Even when 0 is returned the caller should check
  * scsi_cmnd_io::scsi_status for SCSI defined errors and warnings
  * (e.g. CHECK CONDITION). If the SCSI command could not be issued
  * (e.g. device not present or timeout) or some other problem
@@ -1054,7 +948,7 @@ static int do_normal_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop,
     /* implementation relies on static sg_io_state variable. If not
      * previously set tries the SG_IO ioctl. If that succeeds assume
      * that SG_IO ioctl functional. If it fails with an errno value
-     * other than ENODEV (no device) or permission then assume 
+     * other than ENODEV (no device) or permission then assume
      * SCSI_IOCTL_SEND_COMMAND is the only option. */
     switch (sg_io_state) {
     case SG_IO_PRESENT_UNKNOWN:
@@ -1071,7 +965,7 @@ static int do_normal_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop,
     case SG_IO_PRESENT_YES:
         return sg_io_cmnd_io(dev_fd, iop, report, 0);
     default:
-        pout(">>>> do_scsi_cmnd_io: bad sg_io_state=%d\n", sg_io_state); 
+        pout(">>>> do_scsi_cmnd_io: bad sg_io_state=%d\n", sg_io_state);
         sg_io_state = SG_IO_PRESENT_UNKNOWN;
         return -EIO;    /* report error and reset state */
     }
@@ -1084,7 +978,20 @@ static int do_normal_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop,
      switch(con->controller_type)
      {
          case CONTROLLER_CCISS:
+#ifdef HAVE_LINUX_CCISS_IOCTL_H
              return cciss_io_interface(dev_fd, con->controller_port-1, iop, report);
+#else
+             {
+                 static int warned = 0;
+                 if (!warned) {
+                     pout("CCISS support is not available in this build of smartmontools,\n"
+                          "<linux/cciss_ioctl.h> was not available at build time.\n\n");
+                     warned = 1;
+                 }
+             }
+             errno = ENOSYS;
+             return -1;
+#endif
              // not reached
              break;
          default:
@@ -1093,78 +1000,8 @@ static int do_normal_scsi_cmnd_io(int dev_fd, struct scsi_cmnd_io * iop,
              break;
      }
  }
-// >>>>>> End of general SCSI specific linux code
 
-/* cciss >> CCSISS I/O passthrough
-   This is an interface that uses the cciss passthrough to talk to the SMART controller on
-   the HP system. The cciss driver provides a way to send SCSI cmds through the CCISS passthrough
-   essentially the methods above and below pertain to SCSI, except for the SG driver which is not
-   involved. The CCISS driver does not engage the scsi subsystem. */
- static int cciss_io_interface(int device, int target, struct scsi_cmnd_io * iop, int report)
- {
-     unsigned char pBuf[512] = {0};
-     unsigned char phylun[1024] = {0};
-     int iBufLen = 512;
-     int status = -1;
-     int len = 0; // used later in the code.
-     report = 0;
-     cciss_getlun(device, target, phylun);
-     status = cciss_sendpassthru( 2, iop->cmnd, iop->cmnd_len, (char*) pBuf, iBufLen, 1, phylun, device);
-     if (0 == status)
-     {
-         if (report > 0)
-             printf("  status=0\n");
-         if (DXFER_FROM_DEVICE == iop->dxfer_dir)
-         {
-             memcpy(iop->dxferp, pBuf, iop->dxfer_len);
-             if (report > 1)
-             {
-                 int trunc = (iop->dxfer_len > 256) ? 1 : 0;
-                 printf("  Incoming data, len=%d%s:\n", (int)iop->dxfer_len,
-                      (trunc ? " [only first 256 bytes shown]" : ""));
-                 dStrHex((const char*)iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
-             }
-         }
-         return 0;
-     }
-     iop->scsi_status = status & 0x7e; /* bits 0 and 7 used to be for vendors */
-     if (LSCSI_DRIVER_SENSE == ((status >> 24) & 0xf))
-         iop->scsi_status = SCSI_STATUS_CHECK_CONDITION;
-     len = (SEND_IOCTL_RESP_SENSE_LEN < iop->max_sense_len) ?
-                SEND_IOCTL_RESP_SENSE_LEN : iop->max_sense_len;
-     if ((SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) &&
-         iop->sensep && (len > 0))
-     {
-         memcpy(iop->sensep, pBuf, len);
-         iop->resp_sense_len = iBufLen;
-         if (report > 1)
-         {
-             printf("  >>> Sense buffer, len=%d:\n", (int)len);
-             dStrHex((const char *)pBuf, len , 1);
-         }
-     }
-     if (report)
-     {
-         if (SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) {
-             printf("  status=%x: sense_key=%x asc=%x ascq=%x\n", status & 0xff,
-                  pBuf[2] & 0xf, pBuf[12], pBuf[13]);
-         }
-         else
-             printf("  status=0x%x\n", status);
-     }
-     if (iop->scsi_status > 0)
-         return 0;
-     else
-     {
-         if (report > 0)
-             printf("  ioctl status=0x%x but scsi status=0, fail with EIO\n", status);
-         return -EIO;      /* give up, assume no device there */
-     }
- } 
+// >>>>>> End of general SCSI specific linux code
 
 // prototype
 void printwarning(smart_command_set command);
@@ -1187,7 +1024,7 @@ void printwarning(smart_command_set command);
 // RETURN VALUES
 //  -1 if the command failed
 //   0 if the command succeeded,
-//   STATUS_CHECK routine: 
+//   STATUS_CHECK routine:
 //  -1 if the command failed
 //   0 if the command succeeded and disk SMART status is "OK"
 //   1 if the command succeeded and disk SMART status is "FAILING"
@@ -1217,7 +1054,7 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
 
   // only used for 9000 character device interface
   TW_Ioctl_Buf_Apache *tw_ioctl_apache=NULL;
-  
+
   memset(ioctl_buffer, 0, TW_IOCTL_BUFFER_SIZE);
 
   if (escalade_type==CONTROLLER_3WARE_9000_CHAR) {
@@ -1250,9 +1087,8 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
   // Same for (almost) all commands - but some reset below
   passthru->byte0.opcode  = TW_OP_ATA_PASSTHRU;
   passthru->request_id    = 0xFF;
-  passthru->byte3.aport   = disknum;
-  passthru->byte3.host_id = 0;
-  passthru->status        = 0;           
+  passthru->unit          = disknum;
+  passthru->status        = 0;
   passthru->flags         = 0x1;
   passthru->drive_head    = 0x0;
   passthru->sector_num    = 0;
@@ -1261,10 +1097,10 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
   // values from the ATA specifications.
   passthru->cylinder_lo   = 0x4F;
   passthru->cylinder_hi   = 0xC2;
-  
+
   // SMART ATA COMMAND REGISTER value
   passthru->command       = ATA_SMART_CMD;
-  
+
   // Is this a command that reads or returns 512 bytes?
   // passthru->param values are:
   // 0x0 - non data command without TFR write check,
@@ -1290,14 +1126,14 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
       passthru->size++;
   }
   else {
-    // Non data command -- but doesn't use large sector 
-    // count register values.  
+    // Non data command -- but doesn't use large sector
+    // count register values.
     passthru->byte0.sgloff = 0x0;
     passthru->size         = 0x5;
     passthru->param        = 0x8;
     passthru->sector_count = 0x0;
   }
-  
+
   // Now set ATA registers depending upon command
   switch (command){
   case CHECK_POWER_MODE:
@@ -1392,7 +1228,7 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
     ioctlreturn=ioctl(fd, TW_CMD_PACKET_WITH_DATA, tw_ioctl_char);
   else
     ioctlreturn=ioctl(fd, SCSI_IOCTL_SEND_COMMAND, tw_ioctl);
-  
+
   // Deal with the different error cases
   if (ioctlreturn) {
     if (CONTROLLER_3WARE_678K==escalade_type && ((command==AUTO_OFFLINE || command==AUTOSAVE) && select)){
@@ -1404,9 +1240,9 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
       errno=EIO;
     return -1;
   }
-  
+
   // The passthru structure is valid after return from an ioctl if:
-  // - we are using the character interface OR 
+  // - we are using the character interface OR
   // - we are using the SCSI interface and this is a NON-READ-DATA command
   // For SCSI interface, note that we set passthru to a different
   // value after ioctl().
@@ -1428,12 +1264,12 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
   // While we *might* decode the ATA ERROR register, at the moment it
   // doesn't make much sense: we don't care in detail why the error
   // happened.
-  
+
   if (passthru && (passthru->status || (passthru->command & 0x21))) {
     errno=EIO;
     return -1;
   }
-  
+
   // If this is a read data command, copy data to output buffer
   if (readdata) {
     if (escalade_type==CONTROLLER_3WARE_9000_CHAR)
@@ -1446,22 +1282,22 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
 
   // For STATUS_CHECK, we need to check register values
   if (command==STATUS_CHECK) {
-    
+
     // To find out if the SMART RETURN STATUS is good or failing, we
     // need to examine the values of the Cylinder Low and Cylinder
     // High Registers.
-    
+
     unsigned short cyl_lo=passthru->cylinder_lo;
     unsigned short cyl_hi=passthru->cylinder_hi;
-    
+
     // If values in Cyl-LO and Cyl-HI are unchanged, SMART status is good.
     if (cyl_lo==0x4F && cyl_hi==0xC2)
       return 0;
-    
+
     // If values in Cyl-LO and Cyl-HI are as follows, SMART status is FAIL
     if (cyl_lo==0xF4 && cyl_hi==0x2C)
       return 1;
-    
+
     // Any other values mean that something has gone wrong with the command
     if (CONTROLLER_3WARE_678K==escalade_type) {
       printwarning(command);
@@ -1473,32 +1309,32 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
       return -1;
     }
   }
-  
+
   // copy sector count register (one byte!) to return data
   if (command==CHECK_POWER_MODE)
     *data=*(char *)&(passthru->sector_count);
-  
+
   // look for nonexistent devices/ports
   if (command==IDENTIFY && !nonempty((unsigned char *)data, 512)) {
     errno=ENODEV;
     return -1;
   }
-  
+
   return 0;
 }
 
 
 
-int marvell_command_interface(int device, 
-                              smart_command_set command, 
-                              int select, 
-                              char *data) {  
-  typedef struct {  
+int marvell_command_interface(int device,
+                              smart_command_set command,
+                              int select,
+                              char *data) {
+  typedef struct {
     int  inlen;
     int  outlen;
     char cmd[540];
   } mvsata_scsi_cmd;
-  
+
   int copydata = 0;
   mvsata_scsi_cmd  smart_command;
   unsigned char *buff = (unsigned char *)&smart_command.cmd[6];
@@ -1507,14 +1343,14 @@ int marvell_command_interface(int device,
   // buff[1]: ATA SECTOR NUMBER REGISTER
   // buff[2]: ATA FEATURES REGISTER
   // buff[3]: ATA SECTOR COUNT REGISTER
-  
+
   // clear out buff.  Large enough for HDIO_DRIVE_CMD (4+512 bytes)
   memset(&smart_command, 0, sizeof(smart_command));
   smart_command.inlen = 540;
   smart_command.outlen = 540;
   smart_command.cmd[0] = 0xC;  //Vendor-specific code
   smart_command.cmd[4] = 6;     //command length
-  
+
   buff[0] = ATA_SMART_CMD;
   switch (command){
   case CHECK_POWER_MODE:
@@ -1571,7 +1407,7 @@ int marvell_command_interface(int device,
     pout("Unrecognized command %d in mvsata_os_specific_handler()\n", command);
     exit(1);
     break;
-  }  
+  }
   // There are two different types of ioctls().  The HDIO_DRIVE_TASK
   // one is this:
   // We are now doing the HDIO_DRIVE_CMD type ioctl.
@@ -1585,19 +1421,19 @@ int marvell_command_interface(int device,
     return 0;
   }
 
-  // Always succeed on a SMART status, as a disk that failed returned  
+  // Always succeed on a SMART status, as a disk that failed returned
   // buff[4]=0xF4, buff[5]=0x2C, i.e. "Bad SMART status" (see below).
   if (command == STATUS)
     return 0;
-  //Data returned is starting from 0 offset  
+  //Data returned is starting from 0 offset
   if (command == STATUS_CHECK)
   {
     // Cyl low and Cyl high unchanged means "Good SMART status"
     if (buff[4] == 0x4F && buff[5] == 0xC2)
-      return 0;    
+      return 0;
     // These values mean "Bad SMART status"
     if (buff[4] == 0xF4 && buff[5] == 0x2C)
-      return 1;    
+      return 1;
     // We haven't gotten output that makes sense; print out some debugging info
     syserror("Error SMART Status command failed");
     pout("Please get assistance from %s\n",PACKAGE_BUGREPORT);
@@ -1609,17 +1445,17 @@ int marvell_command_interface(int device,
     pout("CL =0x%02x\n",(int)buff[4]);
     pout("CH =0x%02x\n",(int)buff[5]);
     pout("SEL=0x%02x\n",(int)buff[6]);
-    return -1;   
-  }  
+    return -1;
+  }
 
   if (copydata)
     memcpy(data, buff, 512);
-  return 0; 
+  return 0;
 }
 
 // this implementation is derived from ata_command_interface with a header
 // packing for highpoint linux driver ioctl interface
-// 
+//
 // ioctl(fd,HPTIO_CTL,buff)
 //          ^^^^^^^^^
 //
@@ -1627,7 +1463,7 @@ int marvell_command_interface(int device,
 // +----+----+----+----+--------------------.....---------------------+
 // | 1  | 2  | 3  | 4  | 5                                            |
 // +----+----+----+----+--------------------.....---------------------+
-// 
+//
 // 1: The target controller                     [ int    ( 4 Bytes ) ]
 // 2: The channel of the target controllee      [ int    ( 4 Bytes ) ]
 // 3: HDIO_ ioctl call                          [ int    ( 4 Bytes ) ]
@@ -1635,9 +1471,13 @@ int marvell_command_interface(int device,
 // 4: the pmport that disk attached,            [ int    ( 4 Bytes ) ]
 //    if no pmport device, set to 1 or leave blank
 // 5: data                                      [ void * ( var leangth ) ]
-// 
+//
+#define STRANGE_BUFFER_LENGTH (4+512*0xf8)
+
 int highpoint_command_interface(int device, smart_command_set command,
                                 int select, char *data)
+
+
 {
   unsigned char hpt_buff[4*sizeof(int) + STRANGE_BUFFER_LENGTH];
   unsigned int *hpt = (unsigned int *)hpt_buff;
@@ -1739,12 +1579,12 @@ int highpoint_command_interface(int device, smart_command_set command,
     taskfile->high_cylinder  = 0xc2;
     taskfile->device_head    = 0;
     taskfile->command        = ATA_SMART_CMD;
-    
+
     reqtask->data_phase      = TASKFILE_OUT;
     reqtask->req_cmd         = IDE_DRIVE_TASK_OUT;
     reqtask->out_size        = 512;
     reqtask->in_size         = 0;
-    
+
     memcpy(task+sizeof(ide_task_request_t)+4*sizeof(int), data, 512);
 
     if ((retval=ioctl(device, HPTIO_CTL, task))) {
@@ -1754,7 +1594,7 @@ int highpoint_command_interface(int device, smart_command_set command,
     }
     return 0;
   }
-    
+
   if (command==STATUS_CHECK){
     int retval;
     unsigned const char normal_lo=0x4f, normal_hi=0xc2;
@@ -1773,13 +1613,13 @@ int highpoint_command_interface(int device, smart_command_set command,
         syserror("Error SMART Status command failed");
       return -1;
     }
-    
+
     if (buff[4]==normal_lo && buff[5]==normal_hi)
       return 0;
-    
+
     if (buff[4]==failed_lo && buff[5]==failed_hi)
       return 1;
-    
+
     syserror("Error SMART Status command failed");
     pout("Please get assistance from " PACKAGE_HOMEPAGE "\n");
     pout("Register values returned from SMART Status command are:\n");
@@ -1790,9 +1630,9 @@ int highpoint_command_interface(int device, smart_command_set command,
     pout("CL =0x%02x\n",(int)buff[4]);
     pout("CH =0x%02x\n",(int)buff[5]);
     pout("SEL=0x%02x\n",(int)buff[6]);
-    return -1;   
+    return -1;
   }
-  
+
 #if 1
   if (command==IDENTIFY || command==PIDENTIFY) {
     unsigned char deviceid[4*sizeof(int)+512*sizeof(char)];
@@ -1807,7 +1647,7 @@ int highpoint_command_interface(int device, smart_command_set command,
       buff[0]=(command==IDENTIFY)?ATA_IDENTIFY_PACKET_DEVICE:ATA_IDENTIFY_DEVICE;
   }
 #endif
-  
+
   hpt[2] = HDIO_DRIVE_CMD;
   if ((ioctl(device, HPTIO_CTL, hpt_buff)))
     return -1;
@@ -1817,8 +1657,8 @@ int highpoint_command_interface(int device, smart_command_set command,
 
   if (copydata)
     memcpy(data, buff+HDIO_DRIVE_CMD_OFFSET, copydata);
-  
-  return 0; 
+
+  return 0;
 }
 
 
@@ -1834,7 +1674,7 @@ void printwarning(smart_command_set command){
   if (command==AUTO_OFFLINE && !printed[0]) {
     printed[0]=1;
     pout("The SMART AUTO-OFFLINE ENABLE command (smartmontools -o on option/Directive)\n%s", message);
-  } 
+  }
   else if (command==AUTOSAVE && !printed[1]) {
     printed[1]=1;
     pout("The SMART AUTOSAVE ENABLE command (smartmontools -S on option/Directive)\n%s", message);
@@ -1847,7 +1687,7 @@ void printwarning(smart_command_set command){
     printed[3]=1;
     pout("The SMART WRITE LOG command (smartmontools -t selective) only supported via char /dev/tw[ae] interface\n");
   }
-  
+
   return;
 }
 
@@ -1869,11 +1709,11 @@ static const char * lin_dev_cciss_dir = "cciss/";
 int guess_device_type(const char * dev_name) {
   int len;
   int dev_prefix_len = strlen(lin_dev_prefix);
-  
+
   // if dev_name null, or string length zero
   if (!dev_name || !(len = strlen(dev_name)))
     return CONTROLLER_UNKNOWN;
-  
+
   // Remove the leading /dev/... if it's there
   if (!strncmp(lin_dev_prefix, dev_name, dev_prefix_len)) {
     if (len <= dev_prefix_len)
@@ -1882,12 +1722,12 @@ int guess_device_type(const char * dev_name) {
     // else advance pointer to following characters
     dev_name += dev_prefix_len;
   }
-  
+
   // form /dev/h* or h*
   if (!strncmp(lin_dev_ata_disk_plus, dev_name,
                strlen(lin_dev_ata_disk_plus)))
     return CONTROLLER_ATA;
-  
+
   // form /dev/ide/* or ide/*
   if (!strncmp(lin_dev_ata_devfs_disk_plus, dev_name,
                strlen(lin_dev_ata_devfs_disk_plus)))
@@ -1902,17 +1742,17 @@ int guess_device_type(const char * dev_name) {
   if (!strncmp(lin_dev_scsi_devfs_disk_plus, dev_name,
                strlen(lin_dev_scsi_devfs_disk_plus)))
     return CONTROLLER_SCSI;
-  
+
   // form /dev/ns* or ns*
   if (!strncmp(lin_dev_scsi_tape1, dev_name,
                strlen(lin_dev_scsi_tape1)))
     return CONTROLLER_SCSI;
-  
+
   // form /dev/os* or os*
   if (!strncmp(lin_dev_scsi_tape2, dev_name,
                strlen(lin_dev_scsi_tape2)))
     return CONTROLLER_SCSI;
-  
+
   // form /dev/nos* or nos*
   if (!strncmp(lin_dev_scsi_tape3, dev_name,
                strlen(lin_dev_scsi_tape3)))
@@ -1950,7 +1790,7 @@ brw-------    1 root     root      33,   0 Dec 31  1969 /dev/ide/host2/bus0/targ
 brw-------    1 root     root      34,   0 Dec 31  1969 /dev/ide/host2/bus1/target0/lun0/disc
 [ed@firestorm ed]$ ls -l  /dev/ide/c*b*t*u*
 ls: /dev/ide/c*b*t*u*: No such file or directory
-[ed@firestorm ed]$ 
+[ed@firestorm ed]$
 Script done on Fri Nov  7 13:46:28 2003
 
 #endif
index 7ef5cb16cb936b890b19eae1d9fc6ae576310584..6c1228d3d0f1428485d3f682160a271aa909b805 100644 (file)
@@ -38,7 +38,7 @@
 #ifndef OS_LINUX_H_
 #define OS_LINUX_H_
 
-#define OS_LINUX_H_CVSID "$Id: os_linux.h,v 1.25 2006/08/25 06:06:25 sxzzsf Exp $\n"
+#define OS_LINUX_H_CVSID "$Id: os_linux.h,v 1.26 2007/09/06 08:48:55 ballen4705 Exp $\n"
 
 /* 
    The following definitions/macros/prototypes are used for three
@@ -76,10 +76,7 @@ typedef struct TAG_TW_Passthru {
   } byte0;
   unsigned char size;
   unsigned char request_id;
-  struct { 
-    unsigned char aport:4;
-    unsigned char host_id:4;
-  } byte3;
+  unsigned char unit;
   unsigned char status;  // On return, contains 3ware STATUS register
   unsigned char flags;
   unsigned short param;
index c74b9aab6eab7a6c9a0ea732f489f2dc42eea4ba..e77599ad4517c329ed3e93476e0f79a9d1aed623 100644 (file)
@@ -25,7 +25,7 @@
 #include "utility.h"
 #include "os_openbsd.h"
 
-const char *os_XXXX_c_cvsid = "$Id: os_openbsd.cpp,v 1.13 2006/09/20 16:17:31 shattered Exp $" \
+const char *os_XXXX_c_cvsid = "$Id: os_openbsd.cpp,v 1.14 2007/04/05 16:39:21 shattered Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_OPENBSD_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 /* global variable holding byte count of allocated memory */
@@ -105,7 +105,7 @@ get_dev_names(char ***names, const char *prefix)
     pout("Failed to get value of sysctl `hw.disknames'\n");
     return -1;
   }
-  if (!(disknames = (char*)malloc(sysctl_len))) {
+  if (!(disknames = (char *)malloc(sysctl_len))) {
     pout("Out of memory constructing scan device list\n");
     return -1;
   }
@@ -121,7 +121,7 @@ get_dev_names(char ***names, const char *prefix)
     if (strncmp(p, prefix, strlen(prefix))) {
       continue;
     }
-    mp[n] = (char*)malloc(strlen(net_dev_prefix) + strlen(p) + 2);
+    mp[n] = (char *)malloc(strlen(net_dev_prefix) + strlen(p) + 2);
     if (!mp[n]) {
       pout("Out of memory constructing scan device list\n");
       return -1;
@@ -131,7 +131,7 @@ get_dev_names(char ***names, const char *prefix)
     n++;
   }
 
-  mp = (char**)realloc(mp, n * (sizeof(char *)));
+  mp = (char **)realloc(mp, n * (sizeof(char *)));
   bytes += (n) * (sizeof(char *));
   *names = mp;
   return n;
@@ -390,12 +390,12 @@ do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
   memset(&sc, 0, sizeof(sc));
   memcpy(sc.cmd, iop->cmnd, iop->cmnd_len);
   sc.cmdlen = iop->cmnd_len;
-  sc.databuf = (char*)iop->dxferp;
+  sc.databuf = (char *)iop->dxferp;
   sc.datalen = iop->dxfer_len;
   sc.senselen = iop->max_sense_len;
   sc.timeout = iop->timeout == 0 ? 60000 : iop->timeout;       /* XXX */
   sc.flags =
-    (iop->dxfer_dir == DXFER_NONE ? SCCMD_READ :       /* XXX */
+    (iop->dxfer_dir == DXFER_NONE ? SCCMD_READ :
     (iop->dxfer_dir == DXFER_FROM_DEVICE ? SCCMD_READ : SCCMD_WRITE));
 
   if (ioctl(fd, SCIOCCOMMAND, &sc) < 0) {
diff --git a/os_os2.cpp b/os_os2.cpp
new file mode 100644 (file)
index 0000000..797de35
--- /dev/null
@@ -0,0 +1,550 @@
+/*
+ * os_os2.c
+ *
+ * Home page of code is: http://smartmontools.sourceforge.net
+ *
+ * Copyright (C) 2004-6 Yuri Dario <smartmontools-support@lists.sourceforge.net>
+ *
+ * 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 Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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.
+ */
+
+/*
+ *
+ * Thanks to Daniela Engert for providing sample code for SMART ioctl access.
+ *
+ */
+
+// These are needed to define prototypes for the functions defined below
+#include <errno.h>
+#include "atacmds.h"
+#include "scsicmds.h"
+#include "utility.h"
+
+// This is to include whatever prototypes you define in os_generic.h
+#include "os_os2.h"
+
+// Needed by '-V' option (CVS versioning) of smartd/smartctl
+const char *os_XXXX_c_cvsid="$Id: os_os2.cpp,v 1.7 2006/09/20 16:17:31 shattered Exp $" \
+ATACMDS_H_CVSID OS_XXXX_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
+
+// global handle to device driver
+static HFILE hDevice;
+
+// Please eliminate the following block: both the two #includes and
+// the 'unsupported()' function.  They are only here to warn
+// unsuspecting users that their Operating System is not supported! If
+// you wish, you can use a similar warning mechanism for any of the
+// functions in this file that you can not (or choose not to)
+// implement.
+
+#include "config.h"
+
+typedef struct _IDEREGS {
+       UCHAR  bFeaturesReg;
+       UCHAR  bSectorCountReg;
+       UCHAR  bSectorNumberReg;
+       UCHAR  bCylLowReg;
+       UCHAR  bCylHighReg;
+       UCHAR  bDriveHeadReg;
+       UCHAR  bCommandReg;
+       UCHAR  bReserved;
+} IDEREGS, *PIDEREGS, *LPIDEREGS;
+
+static void unsupported(int which){
+  static int warninggiven[4];
+
+  if (which<0 || which>3)
+    return;
+
+  if (!warninggiven[which]) {
+    char msg;
+    debugmode=1;
+    warninggiven[which]=1;
+
+    switch (which) {
+    case 0:
+      msg="generate a list of devices";
+      break;
+    case 1:
+      msg="interface to Marvell-based SATA controllers";
+      break;
+    case 2:
+      msg="interface to 3ware-based RAID controllers";
+      break;
+    case 3:
+      msg="interface to SCSI devices";
+      break;
+    }
+    pout("Under OS/2, smartmontools can not %s\n");
+  }
+  return;
+}
+
+// print examples for smartctl.  You should modify this function so
+// that the device paths are sensible for your OS, and to eliminate
+// unsupported commands (eg, 3ware controllers).
+void print_smartctl_examples(){
+  printf("=================================================== SMARTCTL EXAMPLES =====\n\n");
+#ifdef HAVE_GETOPT_LONG
+  printf(
+         "  smartctl -a /dev/hda                       (Prints all SMART information)\n\n"
+         "  smartctl --smart=on --offlineauto=on --saveauto=on /dev/hda\n"
+         "                                              (Enables SMART on first disk)\n\n"
+         "  smartctl -t long /dev/hda              (Executes extended disk self-test)\n\n"
+         "  smartctl --attributes --log=selftest --quietmode=errorsonly /dev/hda\n"
+         "                                      (Prints Self-Test & Attribute errors)\n"
+         "  smartctl -a --device=3ware,2 /dev/sda\n"
+         "          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
+         );
+#else
+  printf(
+         "  smartctl -a /dev/hda                       (Prints all SMART information)\n"
+         "  smartctl -s on -o on -S on /dev/hda         (Enables SMART on first disk)\n"
+         "  smartctl -t long /dev/hda              (Executes extended disk self-test)\n"
+         "  smartctl -A -l selftest -q errorsonly /dev/hda\n"
+         "                                      (Prints Self-Test & Attribute errors)\n"
+         "  smartctl -a -d 3ware,2 /dev/sda\n"
+         "          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
+         );
+#endif
+  return;
+}
+
+static const char * skipdev(const char * s)
+{
+       return (!strncmp(s, "/dev/", 5) ? s + 5 : s);
+}
+
+// tries to guess device type given the name (a path).  See utility.h
+// for return values.
+int guess_device_type (const char* dev_name) {
+
+   //printf( "dev_name %s\n", dev_name);
+   dev_name = skipdev(dev_name);
+       if (!strncmp(dev_name, "hd", 2))
+               return CONTROLLER_ATA;
+       if (!strncmp(dev_name, "scsi", 4))
+               return CONTROLLER_SCSI;
+  return CONTROLLER_UNKNOWN;
+}
+
+// makes a list of ATA or SCSI devices for the DEVICESCAN directive of
+// smartd.  Returns number N of devices, or -1 if out of
+// memory. Allocates N+1 arrays: one of N pointers (devlist); the
+// other N arrays each contain null-terminated character strings.  In
+// the case N==0, no arrays are allocated because the array of 0
+// pointers has zero length, equivalent to calling malloc(0).
+int make_device_names (char*** devlist, const char* name) {
+  unsupported(0);
+  return 0;
+}
+
+// Like open().  Return non-negative integer handle, only used by the
+// functions below.  type=="ATA" or "SCSI".  If you need to store
+// extra information about your devices, create a private internal
+// array within this file (see os_freebsd.cpp for an example).  If you
+// can not open the device (permission denied, does not exist, etc)
+// set errno as open() does and return <0.
+int deviceopen(const char *pathname, char *type){
+
+  int fd;
+  APIRET rc;
+  ULONG ActionTaken;
+
+  //printf( "deviceopen pathname %s\n", pathname);
+  rc = DosOpen ("\\DEV\\IBMS506$", &hDevice, &ActionTaken, 0,  FILE_SYSTEM,
+              OPEN_ACTION_OPEN_IF_EXISTS, OPEN_SHARE_DENYNONE |
+              OPEN_FLAGS_NOINHERIT | OPEN_ACCESS_READONLY, NULL);
+  if (rc) {
+    char errmsg[256];
+    snprintf(errmsg,256,"Smartctl open driver IBMS506$ failed (%d)", rc);
+    errmsg[255]='\0';
+    syserror(errmsg);
+    return -1;
+  }
+
+  pathname = skipdev(pathname);
+  fd = tolower(pathname[2]) - 'a';
+
+  return fd;
+}
+
+// Like close().  Acts only on integer handles returned by
+// deviceopen() above.
+int deviceclose(int fd){
+
+  DosClose( hDevice);
+  hDevice = NULL;
+
+  return 0;
+}
+
+static void print_ide_regs(const IDEREGS * r, int out)
+{
+       pout("%s=0x%02x,%s=0x%02x, SC=0x%02x, NS=0x%02x, CL=0x%02x, CH=0x%02x, SEL=0x%02x\n",
+       (out?"STS":"CMD"), r->bCommandReg, (out?"ERR":" FR"), r->bFeaturesReg,
+       r->bSectorCountReg, r->bSectorNumberReg, r->bCylLowReg, r->bCylHighReg, r->bDriveHeadReg);
+}
+
+//
+// OS/2 direct ioctl interface to IBMS506$
+//
+int dani_ioctl( int device, int request, void* arg)
+{
+   unsigned char* buff = (unsigned char*) arg;
+   APIRET rc;
+   DSKSP_CommandParameters Parms;
+   ULONG PLen = 1;
+   ULONG DLen = 512; //sizeof (*buf);
+   UCHAR temp;
+   ULONG value = 0;
+   IDEREGS  regs;
+
+   //printf( "device %d, request 0x%x, arg[0] 0x%x, arg[2] 0x%x\n", device, request, buff[0], buff[2]);
+
+   Parms.byPhysicalUnit = device;
+   switch( buff[0]) {
+   case WIN_IDENTIFY:
+      rc = DosDevIOCtl (hDevice, DSKSP_CAT_GENERIC, DSKSP_GET_INQUIRY_DATA,
+                    (PVOID)&Parms, PLen, &PLen, (PVOID)arg+4, DLen, &DLen);
+      if (rc != 0)
+      {
+          printf ("DANIS506 ATA GET HD Failed (%d,0x%x)\n", rc, rc);
+          return -1;
+      }
+      break;
+   case WIN_SMART:
+      switch( buff[2]) {
+      case SMART_STATUS:
+         DLen = sizeof(value);
+         // OS/2 already checks CL/CH in IBM1S506 code!! see s506rte.c (ddk)
+         // value: -1=not supported, 0=ok, 1=failing
+         rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_GETSTATUS,
+                    (PVOID)&Parms, PLen, &PLen, (PVOID)&value, DLen, &DLen);
+         if (rc)
+         {
+             printf ("DANIS506 ATA GET SMART_STATUS failed (%d,0x%x)\n", rc, rc);
+             return -1;
+         }
+         buff[4] = (unsigned char)value;
+         break;
+      case SMART_READ_VALUES:
+         rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_GET_ATTRIBUTES,
+                    (PVOID)&Parms, PLen, &PLen, (PVOID)arg+4, DLen, &DLen);
+         if (rc)
+         {
+             printf ("DANIS506 ATA GET DSKSP_SMART_GET_ATTRIBUTES failed (%d,0x%x)\n", rc, rc);
+             return -1;
+         }
+         break;
+      case SMART_READ_THRESHOLDS:
+         rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_GET_THRESHOLDS,
+                    (PVOID)&Parms, PLen, &PLen, (PVOID)arg+4, DLen, &DLen);
+         if (rc)
+         {
+             printf ("DANIS506 ATA GET DSKSP_SMART_GET_THRESHOLDS failed (%d,0x%x)\n", rc, rc);
+             return -1;
+         }
+         break;
+      case SMART_READ_LOG_SECTOR:
+         buff[4] = buff[1]; // copy select field
+         rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_READ_LOG,
+                    (PVOID)&Parms, PLen, &PLen, (PVOID)arg+4, DLen, &DLen);
+         if (rc)
+         {
+             printf ("DANIS506 ATA GET DSKSP_SMART_READ_LOG failed (%d,0x%x)\n", rc, rc);
+             return -1;
+         }
+         break;
+      case SMART_ENABLE:
+         buff[0] = 1; // enable
+         DLen = 1;
+         rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_ONOFF,
+                           (PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
+         if (rc) {
+             printf ("DANIS506 ATA GET DSKSP_SMART_ONOFF failed (%d,0x%x)\n", rc, rc);
+             return -1;
+         }
+         break;
+      case SMART_DISABLE:
+         buff[0] = 0; // disable
+         DLen = 1;
+         rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_ONOFF,
+                           (PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
+         if (rc) {
+             printf ("DANIS506 ATA GET DSKSP_SMART_ONOFF failed (%d,0x%x)\n", rc, rc);
+             return -1;
+         }
+         break;
+#if 0
+      case SMART_AUTO_OFFLINE:
+         buff[0] = buff[3];   // select field
+         DLen = 1;
+         rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_AUTO_OFFLINE,
+                           (PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
+         if (rc) {
+             printf ("DANIS506 ATA GET DSKSP_SMART_ONOFF failed (%d,0x%x)\n", rc, rc);
+             return -1;
+         }
+         break;
+#endif
+      case SMART_AUTOSAVE:
+         buff[0] = buff[3];   // select field
+         DLen = 1;
+         rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_AUTOSAVE_ONOFF,
+                           (PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
+         if (rc) {
+             printf ("DANIS506 ATA DSKSP_SMART_AUTOSAVE_ONOFF failed (%d,0x%x)\n", rc, rc);
+             return -1;
+         }
+         break;
+      case SMART_IMMEDIATE_OFFLINE:
+         buff[0] = buff[1];   // select field
+         DLen = 1;
+         rc = DosDevIOCtl (hDevice, DSKSP_CAT_SMART, DSKSP_SMART_EOLI,
+                           (PVOID)&Parms, PLen, &PLen, (PVOID)buff, DLen, &DLen);
+         if (rc) {
+             printf ("DANIS506 ATA GET DSKSP_SMART_EXEC_OFFLINE failed (%d,0x%x)\n", rc, rc);
+             return -1;
+         }
+         break;
+
+      default:
+         fprintf( stderr, "device %d, request 0x%x, arg[0] 0x%x, arg[2] 0x%x\n", device, request, buff[0], buff[2]);
+         fprintf( stderr, "unknown ioctl\n");
+         return -1;
+         break;
+      }
+      break;
+   //case WIN_PIDENTIFY:
+   //   break;
+   default:
+      fprintf( stderr, "unknown ioctl\n");
+      return -1;
+      break;
+   }
+
+   // ok
+   return 0;
+}
+
+// Interface to ATA devices.  See os_linux.cpp for the cannonical example.
+// DETAILED DESCRIPTION OF ARGUMENTS
+//   device: is the integer handle provided by deviceopen()
+//   command: defines the different operations, see atacmds.h
+//   select: additional input data IF NEEDED (which log, which type of
+//           self-test).
+//   data:   location to write output data, IF NEEDED (1 or 512 bytes).
+//   Note: not all commands use all arguments.
+// RETURN VALUES (for all commands BUT command==STATUS_CHECK)
+//  -1 if the command failed
+//   0 if the command succeeded,
+// RETURN VALUES if command==STATUS_CHECK
+//  -1 if the command failed OR the disk SMART status can't be determined
+//   0 if the command succeeded and disk SMART status is "OK"
+//   1 if the command succeeded and disk SMART status is "FAILING"
+
+// huge value of buffer size needed because HDIO_DRIVE_CMD assumes
+// that buff[3] is the data size.  Since the ATA_SMART_AUTOSAVE and
+// ATA_SMART_AUTO_OFFLINE use values of 0xf1 and 0xf8 we need the space.
+// Otherwise a 4+512 byte buffer would be enough.
+#define STRANGE_BUFFER_LENGTH (4+512*0xf8)
+
+int ata_command_interface(int device, smart_command_set command, int select, char *data){
+  unsigned char buff[STRANGE_BUFFER_LENGTH];
+  // positive: bytes to write to caller.  negative: bytes to READ from
+  // caller. zero: non-data command
+  int copydata=0;
+
+  const int HDIO_DRIVE_CMD_OFFSET = 4;
+
+  // See struct hd_drive_cmd_hdr in hdreg.h.  Before calling ioctl()
+  // buff[0]: ATA COMMAND CODE REGISTER
+  // buff[1]: ATA SECTOR NUMBER REGISTER == LBA LOW REGISTER
+  // buff[2]: ATA FEATURES REGISTER
+  // buff[3]: ATA SECTOR COUNT REGISTER
+
+  // Note that on return:
+  // buff[2] contains the ATA SECTOR COUNT REGISTER
+
+  // clear out buff.  Large enough for HDIO_DRIVE_CMD (4+512 bytes)
+  memset(buff, 0, STRANGE_BUFFER_LENGTH);
+
+  //printf( "command, select %d,%d\n", command, select);
+  buff[0]=ATA_SMART_CMD;
+  switch (command){
+  case CHECK_POWER_MODE:
+    buff[0]=ATA_CHECK_POWER_MODE;
+    copydata=1;
+    break;
+  case READ_VALUES:
+    buff[2]=ATA_SMART_READ_VALUES;
+    buff[3]=1;
+    copydata=512;
+    break;
+  case READ_THRESHOLDS:
+    buff[2]=ATA_SMART_READ_THRESHOLDS;
+    buff[1]=buff[3]=1;
+    copydata=512;
+    break;
+  case READ_LOG:
+    buff[2]=ATA_SMART_READ_LOG_SECTOR;
+    buff[1]=select;
+    buff[3]=1;
+    copydata=512;
+    break;
+  case WRITE_LOG:
+    break;
+  case IDENTIFY:
+    buff[0]=ATA_IDENTIFY_DEVICE;
+    buff[3]=1;
+    copydata=512;
+    break;
+  case PIDENTIFY:
+    buff[0]=ATA_IDENTIFY_PACKET_DEVICE;
+    buff[3]=1;
+    copydata=512;
+    break;
+  case ENABLE:
+    buff[2]=ATA_SMART_ENABLE;
+    buff[1]=1;
+    break;
+  case DISABLE:
+    buff[2]=ATA_SMART_DISABLE;
+    buff[1]=1;
+    break;
+  case STATUS:
+  case STATUS_CHECK:
+    // this command only says if SMART is working.  It could be
+    // replaced with STATUS_CHECK below.
+    buff[2]=ATA_SMART_STATUS;
+    buff[4]=0;
+    break;
+  case AUTO_OFFLINE:
+    buff[2]=ATA_SMART_AUTO_OFFLINE;
+    buff[3]=select;   // YET NOTE - THIS IS A NON-DATA COMMAND!!
+    break;
+  case AUTOSAVE:
+    buff[2]=ATA_SMART_AUTOSAVE;
+    buff[3]=select;   // YET NOTE - THIS IS A NON-DATA COMMAND!!
+    break;
+  case IMMEDIATE_OFFLINE:
+    buff[2]=ATA_SMART_IMMEDIATE_OFFLINE;
+    buff[1]=select;
+    break;
+  //case STATUS_CHECK:
+  //  // This command uses HDIO_DRIVE_TASK and has different syntax than
+  //  // the other commands.
+  //  buff[1]=ATA_SMART_STATUS;
+  //  break;
+  default:
+    pout("Unrecognized command %d in linux_ata_command_interface()\n"
+         "Please contact " PACKAGE_BUGREPORT "\n", command);
+    errno=ENOSYS;
+    return -1;
+  }
+
+#if 0
+  // This command uses the HDIO_DRIVE_TASKFILE ioctl(). This is the
+  // only ioctl() that can be used to WRITE data to the disk.
+  if (command==WRITE_LOG) {
+    unsigned char task[sizeof(ide_task_request_t)+512];
+    ide_task_request_t *reqtask=(ide_task_request_t *) task;
+    task_struct_t      *taskfile=(task_struct_t *) reqtask->io_ports;
+    int retval;
+
+    memset(task,      0, sizeof(task));
+
+    taskfile->data           = 0;
+    taskfile->feature        = ATA_SMART_WRITE_LOG_SECTOR;
+    taskfile->sector_count   = 1;
+    taskfile->sector_number  = select;
+    taskfile->low_cylinder   = 0x4f;
+    taskfile->high_cylinder  = 0xc2;
+    taskfile->device_head    = 0;
+    taskfile->command        = ATA_SMART_CMD;
+
+    reqtask->data_phase      = TASKFILE_OUT;
+    reqtask->req_cmd         = IDE_DRIVE_TASK_OUT;
+    reqtask->out_size        = 512;
+    reqtask->in_size         = 0;
+
+    // copy user data into the task request structure
+    memcpy(task+sizeof(ide_task_request_t), data, 512);
+
+    if ((retval=dani_ioctl(device, HDIO_DRIVE_TASKFILE, task))) {
+      if (retval==-EINVAL)
+       pout("Kernel lacks HDIO_DRIVE_TASKFILE support; compile kernel with CONFIG_IDE_TASKFILE_IO set\n");
+      return -1;
+    }
+    return 0;
+  }
+#endif // 0
+
+  // We are now doing the HDIO_DRIVE_CMD type ioctl.
+  if ((dani_ioctl(device, HDIO_DRIVE_CMD, buff)))
+    return -1;
+
+  // There are two different types of ioctls().  The HDIO_DRIVE_TASK
+  // one is this:
+  if (command==STATUS_CHECK){
+    int retval;
+
+    // Cyl low and Cyl high unchanged means "Good SMART status"
+    if (buff[4]==0)
+      return 0;
+
+    // These values mean "Bad SMART status"
+    if (buff[4]==1)
+      return 1;
+
+    // We haven't gotten output that makes sense; print out some debugging info
+    syserror("Error SMART Status command failed");
+    pout("Please get assistance from " PACKAGE_HOMEPAGE "\n");
+    return -1;
+  }
+
+  // CHECK POWER MODE command returns information in the Sector Count
+  // register (buff[3]).  Copy to return data buffer.
+  if (command==CHECK_POWER_MODE)
+    buff[HDIO_DRIVE_CMD_OFFSET]=buff[2];
+
+  // if the command returns data then copy it back
+  if (copydata)
+    memcpy(data, buff+HDIO_DRIVE_CMD_OFFSET, copydata);
+
+  return 0;
+}
+
+int marvell_command_interface(int fd, smart_command_set command, int select, char *data){
+  unsupported(1);
+  return -1;
+}
+
+int highpoint_command_interface(int fd, smart_command_set command, int select, char *data)
+{
+  unsupported(1);
+  return -1;
+}
+
+// Interface to ATA devices behind 3ware escalade RAID controller
+// cards.  Same description as ata_command_interface() above except
+// that 0 <= disknum <= 15 specifies the ATA disk attached to the
+// controller.
+int escalade_command_interface(int fd, int disknum, int escalade_type, smart_command_set command, int select, char *data){
+  unsupported(2);
+  return -1;
+}
+
+// Interface to SCSI devices.  See os_linux.c
+int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report) {
+  unsupported(3);
+  return -ENOSYS;
+}
diff --git a/os_os2.h b/os_os2.h
new file mode 100644 (file)
index 0000000..4a9c130
--- /dev/null
+++ b/os_os2.h
@@ -0,0 +1,70 @@
+/*
+ * os_os2.c
+ *
+ * Home page of code is: http://smartmontools.sourceforge.net
+ *
+ * Copyright (C) 2004-6 Yuri Dario <smartmontools-support@lists.sourceforge.net>
+ *
+ * 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 Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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.
+ */
+
+#ifndef OS_OS2_H_
+#define OS_OS2_H_
+
+#define OS_XXXX_H_CVSID "$Id: os_os2.h,v 1.4 2006/04/12 14:54:28 ballen4705 Exp $\n"
+
+// Additional material should start here.  Note: to keep the '-V' CVS
+// reporting option working as intended, you should only #include
+// system include files <something.h>.  Local #include files
+// <"something.h"> should be #included in os_generic.c
+
+#define INCL_DOS
+#include <os2.h>
+
+#include "os_os2\hdreg.h"
+#include "os_linux.h"
+
+#pragma pack(1)
+
+#define DSKSP_CAT_SMART             0x80  /* SMART IOCTL category */
+#define DSKSP_SMART_ONOFF           0x20  /* turn SMART on or off */
+#define DSKSP_SMART_AUTOSAVE_ONOFF  0x21  /* turn SMART autosave on or off */
+#define DSKSP_SMART_SAVE            0x22  /* force save of SMART data */
+#define DSKSP_SMART_GETSTATUS       0x23  /* get SMART status (pass/fail) */
+#define DSKSP_SMART_GET_ATTRIBUTES  0x24  /* get SMART attributes table */
+#define DSKSP_SMART_GET_THRESHOLDS  0x25  /* get SMART thresholds table */
+#define DSKSP_SMART_READ_LOG        0x26  
+#define DSKSP_SMART_WRITE_LOG       0x27  
+#define DSKSP_SMART_READ_LOG_EXT    0x28  
+#define DSKSP_SMART_WRITE_LOG_EXT   0x29  
+#define DSKSP_SMART_EOLI            0x30  /* EXECUTE OFF-LINE IMMEDIATE */
+
+#define SMART_CMD_ON      1   /* on  value for related SMART functions */
+#define SMART_CMD_OFF     0   /* off value for related SMART functions */
+
+#define DSKSP_CAT_GENERIC           0x90  /* generic IOCTL category */
+#define DSKSP_GET_INQUIRY_DATA      0x42  /* get ATA/ATAPI inquiry data */
+
+typedef struct _DSKSP_CommandParameters {
+  BYTE byPhysicalUnit;            /* physical unit number 0-n */
+                                  /* 0 = 1st disk, 1 = 2nd disk, ...*/
+                                  /* 0x80 = Pri/Mas, 0x81=Pri/Sla, 0x82=Sec/Mas,*/
+} DSKSP_CommandParameters, *PDSKSP_CommandParameters;
+
+struct SMART_ParamExt {
+  UCHAR      byPhysicalUnit;  // 0=Pri/Mas, 1=Pri/Sla, 2=Sec/Mas, etc.
+  ULONG      LogAddress;      // valid values 0-255. See ATA/ATPI standard
+                              // for details
+  ULONG      SectorCount;     // valid values 0-255  See ATA/ATPI standard
+                              // for details
+  ULONG      reserved;        // reserved. must be set to 0
+};
+
+#endif /* OS_GENERIC_H_ */
diff --git a/os_os2/configure.os2 b/os_os2/configure.os2
new file mode 100644 (file)
index 0000000..121b22c
--- /dev/null
@@ -0,0 +1,9 @@
+#! /bin/sh
+CFLAGS="-s -Zomf -O3 -march=pentium -mcpu=pentium3" \
+CXXFLAGS="-s -Zomf -O3 -march=pentium -mcpu=pentium3" \
+LDFLAGS="-s -Zmap -Zhigh-mem -Zomf -Zexe -Zstack 0x100" \
+LIBS=" -lsyslog -lsocket" \
+LN_CP_F="cp.exe" \
+RANLIB="echo" \
+AR="emxomfar" \
+./configure --prefix=/usr/local/smartmontools
diff --git a/os_os2/hdreg.h b/os_os2/hdreg.h
new file mode 100644 (file)
index 0000000..65c4ed1
--- /dev/null
@@ -0,0 +1,333 @@
+#ifndef _LINUX_HDREG_H
+#define _LINUX_HDREG_H
+
+/*
+ * This file contains some defines for the AT-hd-controller.
+ * Various sources.  
+ */
+
+#define HD_IRQ 14              /* the standard disk interrupt */
+
+/* ide.c has its own port definitions in "ide.h" */
+
+/* Hd controller regs. Ref: IBM AT Bios-listing */
+#define HD_DATA                0x1f0   /* _CTL when writing */
+#define HD_ERROR       0x1f1   /* see err-bits */
+#define HD_NSECTOR     0x1f2   /* nr of sectors to read/write */
+#define HD_SECTOR      0x1f3   /* starting sector */
+#define HD_LCYL                0x1f4   /* starting cylinder */
+#define HD_HCYL                0x1f5   /* high byte of starting cyl */
+#define HD_CURRENT     0x1f6   /* 101dhhhh , d=drive, hhhh=head */
+#define HD_STATUS      0x1f7   /* see status-bits */
+#define HD_FEATURE HD_ERROR    /* same io address, read=error, write=feature */
+#define HD_PRECOMP HD_FEATURE  /* obsolete use of this port - predates IDE */
+#define HD_COMMAND HD_STATUS   /* same io address, read=status, write=cmd */
+
+#define HD_CMD         0x3f6   /* used for resets */
+#define HD_ALTSTATUS   0x3f6   /* same as HD_STATUS but doesn't clear irq */
+
+/* remainder is shared between hd.c, ide.c, ide-cd.c, and the hdparm utility */
+
+/* Bits of HD_STATUS */
+#define ERR_STAT       0x01
+#define INDEX_STAT     0x02
+#define ECC_STAT       0x04    /* Corrected error */
+#define DRQ_STAT       0x08
+#define SEEK_STAT      0x10
+#define WRERR_STAT     0x20
+#define READY_STAT     0x40
+#define BUSY_STAT      0x80
+
+/* Values for HD_COMMAND */
+#define WIN_RESTORE            0x10
+#define WIN_READ               0x20
+#define WIN_WRITE              0x30
+#define WIN_WRITE_VERIFY       0x3C
+#define WIN_VERIFY             0x40
+#define WIN_FORMAT             0x50
+#define WIN_INIT               0x60
+#define WIN_SEEK               0x70
+#define WIN_DIAGNOSE           0x90
+#define WIN_SPECIFY            0x91    /* set drive geometry translation */
+#define WIN_IDLEIMMEDIATE      0xE1    /* force drive to become "ready" */
+#define WIN_SETIDLE1           0xE3
+#define WIN_SETIDLE2           0x97
+
+#define WIN_STANDBYNOW1                0xE0
+#define WIN_STANDBYNOW2                0x94
+#define WIN_SLEEPNOW1          0xE6
+#define WIN_SLEEPNOW2          0x99
+#define WIN_CHECKPOWERMODE1    0xE5
+#define WIN_CHECKPOWERMODE2    0x98
+
+#define WIN_DOORLOCK           0xDE    /* lock door on removable drives */
+#define WIN_DOORUNLOCK         0xDF    /* unlock door on removable drives */
+
+#define WIN_MULTREAD           0xC4    /* read sectors using multiple mode */
+#define WIN_MULTWRITE          0xC5    /* write sectors using multiple mode */
+#define WIN_SETMULT            0xC6    /* enable/disable multiple mode */
+#define WIN_IDENTIFY           0xEC    /* ask drive to identify itself */
+#define WIN_IDENTIFY_DMA       0xEE    /* same as WIN_IDENTIFY, but DMA */
+#define WIN_SETFEATURES                0xEF    /* set special drive features */
+#define WIN_READDMA            0xC8    /* read sectors using DMA transfers */
+#define WIN_WRITEDMA           0xCA    /* write sectors using DMA transfers */
+
+#define WIN_QUEUED_SERVICE     0xA2    /* */
+#define WIN_READDMA_QUEUED     0xC7    /* read sectors using Queued DMA transfers */
+#define WIN_WRITEDMA_QUEUED    0xCC    /* write sectors using Queued DMA transfers */
+
+#define WIN_READ_BUFFER                0xE4    /* force read only 1 sector */
+#define WIN_WRITE_BUFFER       0xE8    /* force write only 1 sector */
+
+#define WIN_SMART              0xB0    /* self-monitoring and reporting */
+
+/* Additional drive command codes used by ATAPI devices. */
+#define WIN_PIDENTIFY          0xA1    /* identify ATAPI device        */
+#define WIN_SRST               0x08    /* ATAPI soft reset command */
+#define WIN_PACKETCMD          0xA0    /* Send a packet command. */
+
+#define DISABLE_SEAGATE                0xFB
+#define EXABYTE_ENABLE_NEST    0xF0
+
+/* WIN_SMART sub-commands */
+
+#define SMART_READ_VALUES      0xd0
+#define SMART_READ_THRESHOLDS  0xd1
+#define SMART_AUTOSAVE         0xd2
+#define SMART_SAVE             0xd3
+#define SMART_IMMEDIATE_OFFLINE        0xd4
+#define SMART_READ_LOG_SECTOR  0xd5
+#define SMART_WRITE_LOG_SECTOR 0xd6
+#define SMART_ENABLE           0xd8
+#define SMART_DISABLE          0xd9
+#define SMART_STATUS           0xda
+#define SMART_AUTO_OFFLINE     0xdb
+
+/* WIN_SETFEATURES sub-commands */
+
+#define SETFEATURES_EN_WCACHE  0x02    /* Enable write cache */
+#define SETFEATURES_XFER       0x03    /* Set transfer mode */
+#      define XFER_UDMA_7      0x47    /* 0100|0111 */
+#      define XFER_UDMA_6      0x46    /* 0100|0110 */
+#      define XFER_UDMA_5      0x45    /* 0100|0101 */
+#      define XFER_UDMA_4      0x44    /* 0100|0100 */
+#      define XFER_UDMA_3      0x43    /* 0100|0011 */
+#      define XFER_UDMA_2      0x42    /* 0100|0010 */
+#      define XFER_UDMA_1      0x41    /* 0100|0001 */
+#      define XFER_UDMA_0      0x40    /* 0100|0000 */
+#      define XFER_MW_DMA_2    0x22    /* 0010|0010 */
+#      define XFER_MW_DMA_1    0x21    /* 0010|0001 */
+#      define XFER_MW_DMA_0    0x20    /* 0010|0000 */
+#      define XFER_SW_DMA_2    0x12    /* 0001|0010 */
+#      define XFER_SW_DMA_1    0x11    /* 0001|0001 */
+#      define XFER_SW_DMA_0    0x10    /* 0001|0000 */
+#      define XFER_PIO_4       0x0C    /* 0000|1100 */
+#      define XFER_PIO_3       0x0B    /* 0000|1011 */
+#      define XFER_PIO_2       0x0A    /* 0000|1010 */
+#      define XFER_PIO_1       0x09    /* 0000|1001 */
+#      define XFER_PIO_0       0x08    /* 0000|1000 */
+#      define XFER_PIO_SLOW    0x00    /* 0000|0000 */
+#define SETFEATURES_DIS_DEFECT 0x04    /* Disable Defect Management */
+#define SETFEATURES_EN_APM     0x05    /* Enable advanced power management */
+#define SETFEATURES_DIS_MSN    0x31    /* Disable Media Status Notification */
+#define SETFEATURES_DIS_RLA    0x55    /* Disable read look-ahead feature */
+#define SETFEATURES_EN_RI      0x5D    /* Enable release interrupt */
+#define SETFEATURES_EN_SI      0x5E    /* Enable SERVICE interrupt */
+#define SETFEATURES_DIS_RPOD   0x66    /* Disable reverting to power on defaults */
+#define SETFEATURES_DIS_WCACHE 0x82    /* Disable write cache */
+#define SETFEATURES_EN_DEFECT  0x84    /* Enable Defect Management */
+#define SETFEATURES_DIS_APM    0x85    /* Disable advanced power management */
+#define SETFEATURES_EN_MSN     0x95    /* Enable Media Status Notification */
+#define SETFEATURES_EN_RLA     0xAA    /* Enable read look-ahead feature */
+#define SETFEATURES_PREFETCH   0xAB    /* Sets drive prefetch value */
+#define SETFEATURES_EN_RPOD    0xCC    /* Enable reverting to power on defaults */
+#define SETFEATURES_DIS_RI     0xDD    /* Disable release interrupt */
+#define SETFEATURES_DIS_SI     0xDE    /* Disable SERVICE interrupt */
+
+/* WIN_SECURITY sub-commands */
+
+#define SECURITY_SET_PASSWORD          0xBA    /* 0xF1 */
+#define SECURITY_UNLOCK                        0xBB    /* 0xF2 */
+#define SECURITY_ERASE_PREPARE         0xBC    /* 0xF3 */
+#define SECURITY_ERASE_UNIT            0xBD    /* 0xF4 */
+#define SECURITY_FREEZE_LOCK           0xBE    /* 0xF5 */
+#define SECURITY_DISABLE_PASSWORD      0xBF    /* 0xF6 */
+
+/* Bits for HD_ERROR */
+#define MARK_ERR       0x01    /* Bad address mark */
+#define TRK0_ERR       0x02    /* couldn't find track 0 */
+#define ABRT_ERR       0x04    /* Command aborted */
+#define MCR_ERR                0x08    /* media change request */
+#define ID_ERR         0x10    /* ID field not found */
+#define ECC_ERR                0x40    /* Uncorrectable ECC error */
+#define        BBD_ERR         0x80    /* pre-EIDE meaning:  block marked bad */
+#define        ICRC_ERR        0x80    /* new meaning:  CRC error during transfer */
+
+struct hd_geometry {
+      unsigned char heads;
+      unsigned char sectors;
+      unsigned short cylinders;
+      unsigned long start;
+};
+
+/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x030n/0x031n */
+#define HDIO_GETGEO            0x0301  /* get device geometry */
+#define HDIO_GET_UNMASKINTR    0x0302  /* get current unmask setting */
+#define HDIO_GET_MULTCOUNT     0x0304  /* get current IDE blockmode setting */
+#define HDIO_OBSOLETE_IDENTITY 0x0307  /* OBSOLETE, DO NOT USE: returns 142 bytes */
+#define HDIO_GET_KEEPSETTINGS  0x0308  /* get keep-settings-on-reset flag */
+#define HDIO_GET_32BIT         0x0309  /* get current io_32bit setting */
+#define HDIO_GET_NOWERR                0x030a  /* get ignore-write-error flag */
+#define HDIO_GET_DMA           0x030b  /* get use-dma flag */
+#define HDIO_GET_NICE          0x030c  /* get nice flags */
+#define HDIO_GET_IDENTITY      0x030d  /* get IDE identification info */
+
+#define HDIO_DRIVE_RESET       0x031c  /* execute a device reset */
+#define HDIO_TRISTATE_HWIF     0x031d  /* execute a channel tristate */
+#ifndef __EMX__
+#define HDIO_DRIVE_TASK                0x031e  /* execute task and special drive command */
+#endif
+#define HDIO_DRIVE_CMD         0x031f  /* execute a special drive command */
+
+#define HDIO_DRIVE_CMD_AEB     HDIO_DRIVE_TASK
+
+/* hd/ide ctl's that pass (arg) non-ptr values are numbered 0x032n/0x033n */
+#define HDIO_SET_MULTCOUNT     0x0321  /* change IDE blockmode */
+#define HDIO_SET_UNMASKINTR    0x0322  /* permit other irqs during I/O */
+#define HDIO_SET_KEEPSETTINGS  0x0323  /* keep ioctl settings on reset */
+#define HDIO_SET_32BIT         0x0324  /* change io_32bit flags */
+#define HDIO_SET_NOWERR                0x0325  /* change ignore-write-error flag */
+#define HDIO_SET_DMA           0x0326  /* change use-dma flag */
+#define HDIO_SET_PIO_MODE      0x0327  /* reconfig interface to new speed */
+#define HDIO_SCAN_HWIF         0x0328  /* register and (re)scan interface */
+#define HDIO_SET_NICE          0x0329  /* set nice flags */
+#define HDIO_UNREGISTER_HWIF   0x032a  /* unregister interface */
+
+/* BIG GEOMETRY */
+struct hd_big_geometry {
+       unsigned char heads;
+       unsigned char sectors;
+       unsigned int cylinders;
+       unsigned long start;
+};
+
+/* hd/ide ctl's that pass (arg) ptrs to user space are numbered 0x033n/0x033n */
+#define HDIO_GETGEO_BIG                0x0330  /* */
+#define HDIO_GETGEO_BIG_RAW    0x0331  /* */
+
+#define __NEW_HD_DRIVE_ID
+/* structure returned by HDIO_GET_IDENTITY, as per ANSI ATA2 rev.2f spec */
+struct hd_driveid {
+       unsigned short  config;         /* lots of obsolete bit flags */
+       unsigned short  cyls;           /* "physical" cyls */
+       unsigned short  reserved2;      /* reserved (word 2) */
+       unsigned short  heads;          /* "physical" heads */
+       unsigned short  track_bytes;    /* unformatted bytes per track */
+       unsigned short  sector_bytes;   /* unformatted bytes per sector */
+       unsigned short  sectors;        /* "physical" sectors per track */
+       unsigned short  vendor0;        /* vendor unique */
+       unsigned short  vendor1;        /* vendor unique */
+       unsigned short  vendor2;        /* vendor unique */
+       unsigned char   serial_no[20];  /* 0 = not_specified */
+       unsigned short  buf_type;
+       unsigned short  buf_size;       /* 512 byte increments; 0 = not_specified */
+       unsigned short  ecc_bytes;      /* for r/w long cmds; 0 = not_specified */
+       unsigned char   fw_rev[8];      /* 0 = not_specified */
+       unsigned char   model[40];      /* 0 = not_specified */
+       unsigned char   max_multsect;   /* 0=not_implemented */
+       unsigned char   vendor3;        /* vendor unique */
+       unsigned short  dword_io;       /* 0=not_implemented; 1=implemented */
+       unsigned char   vendor4;        /* vendor unique */
+       unsigned char   capability;     /* bits 0:DMA 1:LBA 2:IORDYsw 3:IORDYsup*/
+       unsigned short  reserved50;     /* reserved (word 50) */
+       unsigned char   vendor5;        /* vendor unique */
+       unsigned char   tPIO;           /* 0=slow, 1=medium, 2=fast */
+       unsigned char   vendor6;        /* vendor unique */
+       unsigned char   tDMA;           /* 0=slow, 1=medium, 2=fast */
+       unsigned short  field_valid;    /* bits 0:cur_ok 1:eide_ok */
+       unsigned short  cur_cyls;       /* logical cylinders */
+       unsigned short  cur_heads;      /* logical heads */
+       unsigned short  cur_sectors;    /* logical sectors per track */
+       unsigned short  cur_capacity0;  /* logical total sectors on drive */
+       unsigned short  cur_capacity1;  /*  (2 words, misaligned int)     */
+       unsigned char   multsect;       /* current multiple sector count */
+       unsigned char   multsect_valid; /* when (bit0==1) multsect is ok */
+       unsigned int    lba_capacity;   /* total number of sectors */
+       unsigned short  dma_1word;      /* single-word dma info */
+       unsigned short  dma_mword;      /* multiple-word dma info */
+       unsigned short  eide_pio_modes; /* bits 0:mode3 1:mode4 */
+       unsigned short  eide_dma_min;   /* min mword dma cycle time (ns) */
+       unsigned short  eide_dma_time;  /* recommended mword dma cycle time (ns) */
+       unsigned short  eide_pio;       /* min cycle time (ns), no IORDY  */
+       unsigned short  eide_pio_iordy; /* min cycle time (ns), with IORDY */
+       unsigned short  words69_70[2];  /* reserved words 69-70 */
+       /* HDIO_GET_IDENTITY currently returns only words 0 through 70 */
+       unsigned short  words71_74[4];  /* reserved words 71-74 */
+       unsigned short  queue_depth;    /*  */
+       unsigned short  words76_79[4];  /* reserved words 76-79 */
+       unsigned short  major_rev_num;  /*  */
+       unsigned short  minor_rev_num;  /*  */
+       unsigned short  command_set_1;  /* bits 0:Smart 1:Security 2:Removable 3:PM */
+       unsigned short  command_set_2;  /* bits 14:Smart Enabled 13:0 zero */
+       unsigned short  cfsse;          /* command set-feature supported extensions */
+       unsigned short  cfs_enable_1;   /* command set-feature enabled */
+       unsigned short  cfs_enable_2;   /* command set-feature enabled */
+       unsigned short  csf_default;    /* command set-feature default */
+       unsigned short  dma_ultra;      /*  */
+       unsigned short  word89;         /* reserved (word 89) */
+       unsigned short  word90;         /* reserved (word 90) */
+       unsigned short  CurAPMvalues;   /* current APM values */
+       unsigned short  word92;         /* reserved (word 92) */
+       unsigned short  hw_config;      /* hardware config */
+       unsigned short  words94_125[32];/* reserved words 94-125 */
+       unsigned short  last_lun;       /* reserved (word 126) */
+       unsigned short  word127;        /* reserved (word 127) */
+       unsigned short  dlf;            /* device lock function
+                                        * 15:9 reserved
+                                        * 8    security level 1:max 0:high
+                                        * 7:6  reserved
+                                        * 5    enhanced erase
+                                        * 4    expire
+                                        * 3    frozen
+                                        * 2    locked
+                                        * 1    en/disabled
+                                        * 0    capability
+                                        */
+       unsigned short  csfo;           /* current set features options
+                                        * 15:4 reserved
+                                        * 3    auto reassign
+                                        * 2    reverting
+                                        * 1    read-look-ahead
+                                        * 0    write cache
+                                        */
+       unsigned short  words130_155[26];/* reserved vendor words 130-155 */
+       unsigned short  word156;
+       unsigned short  words157_159[3];/* reserved vendor words 157-159 */
+       unsigned short  words160_255[95];/* reserved words 160-255 */
+};
+
+/*
+ * IDE "nice" flags. These are used on a per drive basis to determine
+ * when to be nice and give more bandwidth to the other devices which
+ * share the same IDE bus.
+ */
+#define IDE_NICE_DSC_OVERLAP   (0)     /* per the DSC overlap protocol */
+#define IDE_NICE_ATAPI_OVERLAP (1)     /* not supported yet */
+#define IDE_NICE_0             (2)     /* when sure that it won't affect us */
+#define IDE_NICE_1             (3)     /* when probably won't affect us much */
+#define IDE_NICE_2             (4)     /* when we know it's on our expense */
+
+#ifdef __KERNEL__
+/*
+ * These routines are used for kernel command line parameters from main.c:
+ */
+#include <linux/config.h>
+
+#if defined(CONFIG_BLK_DEV_IDE) || defined(CONFIG_BLK_DEV_IDE_MODULE)
+int ide_register(int io_port, int ctl_port, int irq);
+void ide_unregister(unsigned int);
+#endif /* CONFIG_BLK_DEV_IDE || CONFIG_BLK_DEV_IDE_MODULE */
+
+#endif  /* __KERNEL__ */
+
+#endif /* _LINUX_HDREG_H */
diff --git a/os_qnxnto.cpp b/os_qnxnto.cpp
new file mode 100644 (file)
index 0000000..13094a9
--- /dev/null
@@ -0,0 +1,627 @@
+
+
+// This is needed for the various HAVE_* macros and PROJECT_* macros.
+#include "config.h"
+
+// These are needed to define prototypes and structures for the
+// functions defined below
+#include "int64.h"
+#include "atacmds.h"
+#include "scsicmds.h"
+#include "utility.h"
+
+// This is to include whatever structures and prototypes you define in
+// os_generic.h
+#include "os_qnxnto.h"
+
+// Needed by '-V' option (CVS versioning) of smartd/smartctl.  You
+// should have one *_H_CVSID macro appearing below for each file
+// appearing with #include "*.h" above.  Please list these (below) in
+// alphabetic/dictionary order.
+const char *os_XXXX_c_cvsid="$Id: os_qnxnto.cpp,v 1.1 2007/11/13 14:53:27 jhering Exp $" \
+ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_QNXNTO_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
+
+
+// This is here to prevent compiler warnings for unused arguments of
+// functions.
+#define ARGUSED(x) ((void)(x))
+
+// Please eliminate the following block: both the #include and
+// the 'unsupported()' function.  They are only here to warn
+// unsuspecting users that their Operating System is not supported! If
+// you wish, you can use a similar warning mechanism for any of the
+// functions in this file that you can not (or choose not to)
+// implement.
+
+
+#ifdef HAVE_UNAME
+#include <sys/utsname.h>
+#endif
+//----------------------------------------------------------------------------------------------
+// private Functions
+static int ata_sense_data(void *sdata,int *error,int *key,int *asc,int *ascq);
+static int ata_interpret_sense(struct cam_pass_thru *cpt,void *sense,int *status,int rcount);
+static int ata_pass_thru(int fd,struct cam_pass_thru *pcpt);
+//----------------------------------------------------------------------------------------------
+static void unsupported(){
+  static int warninggiven;
+
+  if (!warninggiven) {
+    char *osname;
+    extern unsigned char debugmode;
+    unsigned char savedebugmode=debugmode;
+
+#ifdef HAVE_UNAME
+    struct utsname ostype;
+    uname(&ostype);
+    osname=ostype.sysname;
+#else
+    osname="host's";
+#endif
+
+    debugmode=1;
+    pout("\n"
+         "############################################################################\n"
+         "WARNING: smartmontools has not been ported to the %s Operating System.\n"
+         "Please see the files os_generic.cpp and os_generic.h for porting instructions.\n"
+         "############################################################################\n\n",
+         osname);
+    debugmode=savedebugmode;
+    warninggiven=1;
+  }
+
+  return;
+}
+// End of the 'unsupported()' block that you should eliminate.
+
+
+// print examples for smartctl.  You should modify this function so
+// that the device paths are sensible for your OS, and to eliminate
+// unsupported commands (eg, 3ware controllers).
+void print_smartctl_examples(){
+  printf("=================================================== SMARTCTL EXAMPLES =====\n\n");
+#ifdef HAVE_GETOPT_LONG
+  printf(
+         "  smartctl -a /dev/hd0                       (Prints all SMART information)\n\n"
+         "  smartctl --smart=on --offlineauto=on --saveauto=on /dev/hd0\n"
+         "                                              (Enables SMART on first disk)\n\n"
+         "  smartctl -t long /dev/hd0              (Executes extended disk self-test)\n\n"
+         "  smartctl --attributes --log=selftest --quietmode=errorsonly /dev/hd0\n"
+         "                                      (Prints Self-Test & Attribute errors)\n"
+         "  smartctl -a --device=3ware,2 /dev/sda\n"
+         "          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
+         );
+#else
+  printf(
+         "  smartctl -a /dev/hd0                       (Prints all SMART information)\n"
+         "  smartctl -s on -o on -S on /dev/hd0         (Enables SMART on first disk)\n"
+         "  smartctl -t long /dev/hd0              (Executes extended disk self-test)\n"
+         "  smartctl -A -l selftest -q errorsonly /dev/hd0\n"
+         "                                      (Prints Self-Test & Attribute errors)\n"
+         "  smartctl -a -d 3ware,2 /dev/sda\n"
+         "          (Prints all SMART info for 3rd ATA disk on 3ware RAID controller)\n"
+         );
+#endif
+  return;
+}
+
+// tries to guess device type given the name (a path).  See utility.h
+// for return values.
+static const char *net_dev_prefix = "/dev/";
+static const char *net_dev_ata_disk = "hd";
+
+int guess_device_type (const char* dev_name)
+{
+int len,dev_prefix_len;
+  dev_prefix_len=strlen(net_dev_prefix);
+  if(!dev_name||!(len=strlen(dev_name)))
+    return(CONTROLLER_UNKNOWN);
+  if (!strncmp(net_dev_prefix,dev_name,dev_prefix_len))
+   {
+    if(len<=dev_prefix_len)
+      return(CONTROLLER_UNKNOWN);
+    else
+      dev_name += dev_prefix_len;
+   }
+  if(!strncmp(net_dev_ata_disk,dev_name,strlen(net_dev_ata_disk)))
+    return(CONTROLLER_ATA);
+  return(CONTROLLER_UNKNOWN);
+}
+
+// makes a list of ATA or SCSI devices for the DEVICESCAN directive of
+// smartd.  Returns number N of devices, or -1 if out of
+// memory. Allocates N+1 arrays: one of N pointers (devlist); the
+// other N arrays each contain null-terminated character strings.  In
+// the case N==0, no arrays are allocated because the array of 0
+// pointers has zero length, equivalent to calling malloc(0).
+int make_device_names (char*** devlist, const char* name) {
+  ARGUSED(devlist);
+  ARGUSED(name);
+  unsupported();
+  return 0;
+}
+
+// Like open().  Return non-negative integer handle, only used by the
+// functions below.  type=="ATA" or "SCSI".  If you need to store
+// extra information about your devices, create a private internal
+// array within this file (see os_freebsd.cpp for an example).  If you
+// can not open the device (permission denied, does not exist, etc)
+// set errno as open() does and return <0.
+int deviceopen(const char *pathname, char *type)
+{
+  if(!strcmp(type, "ATA"))
+    return(open(pathname,O_RDWR|O_NONBLOCK));
+  else
+    return(-1);
+}
+
+// Like close().  Acts only on integer handles returned by
+// deviceopen() above.
+int deviceclose(int fd)
+{
+  return(close(fd));
+}
+//----------------------------------------------------------------------------------------------
+// Interface to ATA devices.  See os_linux.cpp for the cannonical example.
+// DETAILED DESCRIPTION OF ARGUMENTS
+//   device: is the integer handle provided by deviceopen()
+//   command: defines the different operations, see atacmds.h
+//   select: additional input data IF NEEDED (which log, which type of
+//           self-test).
+//   data:   location to write output data, IF NEEDED (1 or 512 bytes).
+//   Note: not all commands use all arguments.
+// RETURN VALUES (for all commands BUT command==STATUS_CHECK)
+//  -1 if the command failed
+//   0 if the command succeeded,
+// RETURN VALUES if command==STATUS_CHECK
+//  -1 if the command failed OR the disk SMART status can't be determined
+//   0 if the command succeeded and disk SMART status is "OK"
+//   1 if the command succeeded and disk SMART status is "FAILING"
+int ata_command_interface(int fd,smart_command_set command,int select,char *data)
+{
+struct cam_pass_thru cpt;
+ATA_SENSE            sense;
+CDB                  *cdb;
+int                  status,rc;
+  memset(&cpt,0x00,sizeof(struct cam_pass_thru));
+  cdb=(CDB *)cpt.cam_cdb;
+  rc=-1;
+  switch(command)
+   {
+    case READ_VALUES:
+         cpt.cam_flags                 = CAM_DIR_IN;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_dxfer_len             = 512;
+         cpt.cam_data_ptr              = (uint32_t)data;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_PIO_DATA_IN;
+         cdb->ata_pass_thru.flags      = ATA_FLG_T_DIR|ATA_FLG_TLEN_STPSIU;
+         cdb->ata_pass_thru.command    = ATA_SMART_CMD;
+         cdb->ata_pass_thru.features   = ATA_SMART_READ_VALUES;
+         cdb->ata_pass_thru.lba_mid    = ATA_SMART_LBA_MID_SIG;
+         cdb->ata_pass_thru.lba_high   = ATA_SMART_LBA_HI_SIG;
+         break;
+    case READ_THRESHOLDS:
+         cpt.cam_flags                 = CAM_DIR_IN;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_dxfer_len             = 512;
+         cpt.cam_data_ptr              = (uint32_t)data;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_PIO_DATA_IN;
+         cdb->ata_pass_thru.flags      = ATA_FLG_T_DIR|ATA_FLG_TLEN_STPSIU;
+         cdb->ata_pass_thru.command    = ATA_SMART_CMD;
+         cdb->ata_pass_thru.features   = ATA_SMART_READ_THRESHOLDS;
+         cdb->ata_pass_thru.lba_mid    = ATA_SMART_LBA_MID_SIG;
+         cdb->ata_pass_thru.lba_high   = ATA_SMART_LBA_HI_SIG;
+         break;
+    case READ_LOG:
+         cpt.cam_flags                 = CAM_DIR_IN;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_dxfer_len             = 512;
+         cpt.cam_data_ptr              = (uint32_t)data;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_PIO_DATA_IN;
+         cdb->ata_pass_thru.flags      = ATA_FLG_T_DIR | ATA_FLG_TLEN_STPSIU;
+         cdb->ata_pass_thru.command    = ATA_SMART_CMD;
+         cdb->ata_pass_thru.features   = ATA_SMART_READ_LOG_SECTOR;
+         cdb->ata_pass_thru.sector_count= 1;
+         cdb->ata_pass_thru.lba_low    = select;
+         cdb->ata_pass_thru.lba_mid    = ATA_SMART_LBA_MID_SIG;
+         cdb->ata_pass_thru.lba_high   = ATA_SMART_LBA_HI_SIG;
+         break;
+    case WRITE_LOG:
+         return(-1);
+         break;
+    case IDENTIFY:
+         cpt.cam_flags                 = CAM_DIR_IN;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_dxfer_len             = 512;
+         cpt.cam_data_ptr              = (uint32_t)data;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_PIO_DATA_IN;
+         cdb->ata_pass_thru.flags      = ATA_FLG_T_DIR|ATA_FLG_TLEN_STPSIU;
+         cdb->ata_pass_thru.command    = ATA_IDENTIFY_DEVICE;
+         break;
+    case PIDENTIFY:
+         cpt.cam_flags                 = CAM_DIR_IN;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_dxfer_len             = 512;
+         cpt.cam_data_ptr              = (uint32_t)data;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_PIO_DATA_IN;
+         cdb->ata_pass_thru.flags      = ATA_FLG_T_DIR|ATA_FLG_TLEN_STPSIU;
+         cdb->ata_pass_thru.command    = ATA_IDENTIFY_PACKET_DEVICE;
+         break;
+    case ENABLE:
+         cpt.cam_flags                 = CAM_DIR_NONE;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_DATA_NONE;
+         cdb->ata_pass_thru.command    = ATA_SMART_CMD;
+         cdb->ata_pass_thru.features   = ATA_SMART_ENABLE;
+         cdb->ata_pass_thru.lba_mid    = ATA_SMART_LBA_MID_SIG;
+         cdb->ata_pass_thru.lba_high   = ATA_SMART_LBA_HI_SIG;
+         break;
+    case DISABLE:
+         cpt.cam_flags                 = CAM_DIR_NONE;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_DATA_NONE;
+         cdb->ata_pass_thru.command    = ATA_SMART_CMD;
+         cdb->ata_pass_thru.features   = ATA_SMART_DISABLE;
+         cdb->ata_pass_thru.lba_mid    = ATA_SMART_LBA_MID_SIG;
+         cdb->ata_pass_thru.lba_high   = ATA_SMART_LBA_HI_SIG;
+         break;
+    case AUTO_OFFLINE:
+    // NOTE: According to ATAPI 4 and UP, this command is obsolete 
+         cpt.cam_flags                 = CAM_DIR_NONE;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_DATA_NONE;
+         cdb->ata_pass_thru.command    = ATA_SMART_CMD;
+         cdb->ata_pass_thru.features   = ATA_SMART_AUTO_OFFLINE;
+         cdb->ata_pass_thru.lba_low    = select;
+         cdb->ata_pass_thru.lba_mid    = ATA_SMART_LBA_MID_SIG;
+         cdb->ata_pass_thru.lba_high   = ATA_SMART_LBA_HI_SIG;
+         break;
+    case AUTOSAVE:
+         cpt.cam_flags                 = CAM_DIR_NONE;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_DATA_NONE;
+         cdb->ata_pass_thru.command    = ATA_SMART_CMD;
+         cdb->ata_pass_thru.features   = ATA_SMART_AUTOSAVE;
+         cdb->ata_pass_thru.sector_count= select;
+         cdb->ata_pass_thru.lba_mid    = ATA_SMART_LBA_MID_SIG;
+         cdb->ata_pass_thru.lba_high   = ATA_SMART_LBA_HI_SIG;
+         break;
+    case IMMEDIATE_OFFLINE:
+    // NOTE: According to ATAPI 4 and UP, this command is obsolete 
+         cpt.cam_flags                 = CAM_DIR_NONE;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_DATA_NONE;
+         cdb->ata_pass_thru.command    = ATA_SMART_CMD;
+         cdb->ata_pass_thru.features   = ATA_SMART_IMMEDIATE_OFFLINE;
+         cdb->ata_pass_thru.lba_low    = select;
+         cdb->ata_pass_thru.lba_mid    = ATA_SMART_LBA_MID_SIG;
+         cdb->ata_pass_thru.lba_high   = ATA_SMART_LBA_HI_SIG;
+         break;
+    case STATUS_CHECK:
+    // same command, no HDIO in NetBSD 
+    case STATUS:
+         cpt.cam_flags                 = CAM_DIR_NONE;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_DATA_NONE;
+         cdb->ata_pass_thru.flags      = ATA_FLG_CK_COND;
+         cdb->ata_pass_thru.command    = ATA_SMART_CMD;
+         cdb->ata_pass_thru.features   = ATA_SMART_STATUS;
+         cdb->ata_pass_thru.lba_mid    = ATA_SMART_LBA_MID_SIG;
+         cdb->ata_pass_thru.lba_high   = ATA_SMART_LBA_HI_SIG;
+         break;
+    case CHECK_POWER_MODE:
+         cpt.cam_flags                 = CAM_DIR_NONE;
+         cpt.cam_cdb_len               = 16;
+         cpt.cam_sense_len             = sizeof(sense);
+         cpt.cam_sense_ptr             = (uint32_t)&sense;
+         cdb->ata_pass_thru.opcode     = SC_ATA_PT16;
+         cdb->ata_pass_thru.protocol   = ATA_PROTO_DATA_NONE;
+         cdb->ata_pass_thru.flags      = ATA_FLG_CK_COND;
+         cdb->ata_pass_thru.command    = ATA_CHECK_POWER_MODE;
+         break;
+    default:
+         pout("Unrecognized command %d in ata_command_interface()\n", command);
+         errno=ENOSYS;
+         return(-1);
+   }
+// execute now
+  if((status=ata_pass_thru(fd,&cpt))==EOK)
+    if(cpt.cam_status!=CAM_REQ_CMP)
+      ata_interpret_sense(&cpt,&sense,&status,0);
+  rc=status==EOK?0:1;
+  if((command==STATUS||command==STATUS_CHECK)&&status==EOK)
+    rc=((sense.desc.lba_high<<8)|sense.desc.lba_mid)==ATA_SMART_SIG?0:1;
+  if(command==CHECK_POWER_MODE)
+    data[0]=cdb->ata_pass_thru.sector_count;
+// finish
+  return(rc);
+}
+//----------------------------------------------------------------------------------------------
+int marvell_command_interface(int fd, smart_command_set command, int select, char *data)
+{
+  ARGUSED(fd);
+  ARGUSED(command);
+  ARGUSED(select);
+  ARGUSED(data);
+  unsupported();
+  return -1;
+}
+//----------------------------------------------------------------------------------------------
+int highpoint_command_interface(int fd, smart_command_set command, int select, char *data)
+{
+  ARGUSED(fd);
+  ARGUSED(command);
+  ARGUSED(select);
+  ARGUSED(data);
+  unsupported();
+  return -1;
+}
+//----------------------------------------------------------------------------------------------
+// Interface to ATA devices behind 3ware escalade/apache RAID
+// controller cards.  Same description as ata_command_interface()
+// above except that 0 <= disknum <= 15 specifies the ATA disk
+// attached to the controller, and controller_type specifies the
+// precise type of 3ware controller.  See os_linux.c
+int escalade_command_interface(int fd,int disknum,int controller_type,smart_command_set command,int select,char *data)
+{
+  ARGUSED(fd);
+  ARGUSED(disknum);
+  ARGUSED(controller_type);
+  ARGUSED(command);
+  ARGUSED(select);
+  ARGUSED(data);
+
+  unsupported();
+  return -1;
+}
+//----------------------------------------------------------------------------------------------
+#include <errno.h>
+// Interface to SCSI devices.  See os_linux.c
+int do_scsi_cmnd_io(int fd,struct scsi_cmnd_io * iop,int report)
+{
+  ARGUSED(fd);
+  ARGUSED(iop);
+  ARGUSED(report);
+  unsupported();
+  return -ENOSYS;
+}
+//----------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------
+static int ata_sense_data(void *sdata,int *error,int *key,int *asc,int *ascq)
+{
+SCSI_SENSE     *sf;
+SCSI_SENSE_DESCRIPTOR  *sd;
+  sf=(SCSI_SENSE *)sdata;
+  sd=(SCSI_SENSE_DESCRIPTOR *)sdata;
+  *error=sf->error;
+  if(*error & SENSE_DATA_FMT_DESCRIPTOR)
+   {
+    *key=sd->sense & SK_MSK;
+    *asc=sd->asc;
+    *ascq=sd->ascq;
+   }
+  else
+   {
+    *key=sf->sense & SK_MSK;
+    *asc=sf->asc;
+    *ascq=sf->ascq;
+   }
+  return(CAM_SUCCESS);
+}
+//----------------------------------------------------------------------------------------------
+static int ata_interpret_sense(struct cam_pass_thru *cpt,void *sense,int *status,int rcount)
+{
+int retry;
+int key;
+int asc;
+int ascq;
+int error;
+  *status=EIO;
+  retry=CAM_TRUE;
+  if(cpt->cam_status&CAM_AUTOSNS_VALID)
+   {
+    ata_sense_data(sense,&error,&key,&asc,&ascq);
+    switch(key)
+     {
+      case SK_NO_SENSE:                                        // No sense data (no error)
+           retry=CAM_FALSE;
+           *status=EOK;
+           break;
+      case SK_RECOVERED:                                       // Recovered error
+          switch(asc)
+            {
+             case ASC_ATA_PASS_THRU:
+                  switch(ascq)
+                   {
+                    case ASCQ_ATA_PASS_THRU_INFO_AVAIL:
+                         break;
+                    default:
+                         break;
+                   }
+                  break;
+             default:
+                  break;
+            }
+           retry=CAM_FALSE;
+           *status=EOK;
+           break;
+      case SK_NOT_RDY:                                 // Device not ready
+           *status=EAGAIN;
+           switch(asc)
+            {
+             case ASC_NOT_READY:
+                  switch(ascq)
+                   {
+                    case ASCQ_BECOMING_READY:
+                    case ASCQ_CAUSE_NOT_REPORTABLE:
+                    default:
+                    retry=CAM_FALSE;
+                    break;
+                   }
+                  break;
+             case ASC_MEDIA_NOT_PRESENT:
+                  *status=ENXIO;
+                  retry=CAM_FALSE;
+                  break;
+            }
+           break;
+      case SK_MEDIUM:                                          // Medium error
+      case SK_HARDWARE:                                        // Hardware error
+           retry=CAM_FALSE;
+           *status=EIO;
+           break;
+      case SK_ILLEGAL:                                 // Illegal Request (bad command)
+           retry=CAM_FALSE;
+           *status=EINVAL;
+           break;
+      case SK_UNIT_ATN:                                        // Unit Attention
+           switch(asc)
+            {
+             case ASC_MEDIUM_CHANGED:
+                  *status=ESTALE;
+                  retry=CAM_FALSE;
+                  break;
+             case ASC_BUS_RESET:
+                  break;
+            }
+           break;
+      case SK_DATA_PROT:                                       // Data Protect
+           retry=CAM_FALSE;
+           *status=EROFS;
+           break;
+      case SK_VENDOR:                                          // Vendor Specific
+      case SK_CPY_ABORT:                                       // Copy Aborted
+           retry=CAM_FALSE;
+           *status=EIO;
+           break;
+      case SK_CMD_ABORT:                                       // Aborted Command
+           retry=CAM_FALSE;
+           *status=ECANCELED;
+           break;
+      case SK_EQUAL:                                           // Equal
+      case SK_VOL_OFL:                                 // Volume Overflow
+      case SK_MISCMP:                                          // Miscompare
+      case SK_RESERVED:                                        // Reserved
+           break; 
+     }
+    if(*status==EOK)
+     {
+      switch(cpt->cam_status&CAM_STATUS_MASK) 
+       {
+        case CAM_REQ_CMP_ERR:                  // CCB request completed with an err
+             retry=CAM_FALSE;
+             *status=EIO;
+             break;
+        case CAM_BUSY:                                 // CAM subsystem is busy
+             *status=EAGAIN;
+             break;
+        case CAM_REQ_INVALID:                  // CCB request is invalid
+        case CAM_PATH_INVALID:                 // Path ID supplied is invalid
+        case CAM_DEV_NOT_THERE:                        // SCSI device not installed/there
+        case CAM_SEL_TIMEOUT:                  // Target selection timeout
+        case CAM_LUN_INVALID:                  // LUN supplied is invalid
+        case CAM_TID_INVALID:                  // Target ID supplied is invalid
+             retry=CAM_FALSE;
+             *status=ENXIO;
+             break;
+        case CAM_CMD_TIMEOUT:                  // Command timeout
+             *status=rcount?EAGAIN:EIO;
+             break;
+        case CAM_MSG_REJECT_REC:               // Message reject received
+        case CAM_SCSI_BUS_RESET:               // SCSI bus reset sent/received
+        case CAM_UNCOR_PARITY:                 // Uncorrectable parity err occurred
+        case CAM_AUTOSENSE_FAIL:               // Autosense: Request sense cmd fail
+        case CAM_NO_HBA:                               // No HBA detected Error
+        case CAM_DATA_RUN_ERR:                 // Data overrun/underrun error
+             retry=CAM_FALSE;
+             *status=EIO;
+             break;
+        case CAM_UNEXP_BUSFREE:                        // Unexpected BUS free
+        case CAM_SEQUENCE_FAIL:                        // Target bus phase sequence failure
+             *status=EIO;
+             break;
+        case CAM_PROVIDE_FAIL:                 // Unable to provide requ. capability
+             retry=CAM_FALSE;
+             *status=ENOTTY;
+             break;
+        case CAM_CCB_LEN_ERR:                  // CCB length supplied is inadequate
+        case CAM_BDR_SENT:                             // A SCSI BDR msg was sent to target
+        case CAM_REQ_TERMIO:                   // CCB request terminated by the host
+        case CAM_FUNC_NOTAVAIL:                        // The requ. func is not available
+        case CAM_NO_NEXUS:                             // Nexus is not established
+        case CAM_IID_INVALID:                  // The initiator ID is invalid
+        case CAM_CDB_RECVD:                            // The SCSI CDB has been received
+             retry=CAM_FALSE;
+             *status=EIO;
+             break;
+        case CAM_SCSI_BUSY:                            // SCSI bus busy
+             *status=EAGAIN;
+             break;
+       }
+     }
+   }
+  return(retry);
+}
+//----------------------------------------------------------------------------------------------
+static int ata_pass_thru(int fd,struct cam_pass_thru *pcpt)
+{
+int    icnt;
+int    status;
+iov_t  iov[3];
+struct cam_pass_thru   cpt;
+  cpt=*pcpt;
+  icnt=1;
+  SETIOV(&iov[0],&cpt,sizeof(cpt));
+  cpt.cam_timeout=cpt.cam_timeout?cpt.cam_timeout:CAM_TIME_DEFAULT;
+  if(cpt.cam_sense_len)
+   {
+    SETIOV(&iov[1],cpt.cam_sense_ptr,cpt.cam_sense_len);
+    cpt.cam_sense_ptr=sizeof(cpt);
+    icnt++;
+   }
+  if(cpt.cam_dxfer_len)
+   {
+    SETIOV(&iov[2],(void *)cpt.cam_data_ptr,cpt.cam_dxfer_len);
+    cpt.cam_data_ptr=(paddr_t)sizeof(cpt)+cpt.cam_sense_len;
+    icnt++;
+   }
+  if((status=devctlv(fd,DCMD_CAM_PASS_THRU,icnt,icnt,iov,iov,NULL)))
+    pout("ata_pass_thru devctl:  %s\n",strerror(status));
+  pcpt->cam_status=cpt.cam_status;
+  pcpt->cam_scsi_status=cpt.cam_scsi_status;
+  return(status);
+}
+//----------------------------------------------------------------------------------------------
diff --git a/os_qnxnto.h b/os_qnxnto.h
new file mode 100644 (file)
index 0000000..8d724b7
--- /dev/null
@@ -0,0 +1,896 @@
+/*
+ * os_generic.h
+ *
+ * Home page of code is: http://smartmontools.sourceforge.net
+ *
+ * Copyright (C) Joerg Hering       <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2003-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ *
+ * 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 Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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.
+ *
+ * This code was originally developed as a Senior Thesis by Michael Cornwell
+ * 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/
+ *
+ */
+#ifndef OS_QNXNTO_H_
+#define OS_QNXNTO_H_
+#define OS_QNXNTO_H_CVSID "$Id: os_qnxnto.h,v 1.1 2007/11/13 14:53:27 jhering Exp $\n"
+
+// Additional material should start here.  Note: to keep the '-V' CVS
+// reporting option working as intended, you should only #include
+// system include files <something.h>.  Local #include files
+// <"something.h"> should be #included in os_generic.c
+#include <sys/cpt.h>
+
+#ifndef __TYPES_H_INCLUDED
+#include <sys/types.h>
+#endif
+
+#include <stdio.h>
+#include <fcntl.h>
+#include <gulliver.h>
+#include <sys/cpt.h>
+#include <sys/dcmd_cam.h>
+#include <sys/cam_device.h>
+#include "atacmds.h"
+
+//----------------------------------------------------------------------------------------------------------
+typedef struct _ata_pass_thru   ATA_PASS_THRU;
+typedef struct _eide_identify   EIDE_IDENTIFY;
+typedef struct _ata_sense       ATA_SENSE;
+
+typedef void CCB;
+struct _sim_hba;
+struct _resmgr_context;
+
+
+typedef struct _drive_attribute
+ {
+  int  id;
+  int  threshold;
+  char *name;
+ }DRIVE_ATTRIBUTE;
+
+//----------------------------------------------------------------------------------------------------------
+/* UNIVOS OSD defines and data structures. */
+
+#define INQLEN  36              /* Inquiry string length to store. */
+
+#define CAM_SUCCESS     0       /* For signaling general success */
+#define CAM_FAILURE     1       /* For signaling general failure */
+
+#define CAM_FALSE       0       /* General purpose flag value */
+#define CAM_TRUE        1       /* General purpose flag value */
+
+//----------------------------------------------------------------------------------------------------------
+// Group 3 and 4, command codes 60H-9FH are reserved
+#define SC_ATA_PT16     0x85   // ATA Pass-through
+//----------------------------------------------------------------------------------------------------------
+#define ATA_SMART_LBA_MID_SIG  0x4f
+#define ATA_SMART_LBA_HI_SIG   0xc2
+#define ATA_SMART_SIG          0xc24f
+//----------------------------------------------------------------------------------------------------------
+       struct _ata_pass_thru {
+               uchar_t         opcode;
+#define ATA_PROTO_MSK                          0x1e
+#define ATA_PROTO_RESPONSE                     (15 << 1)
+#define ATA_PROTO_FPDMA                                (12 << 1)
+#define ATA_PROTO_UDMA_DATA_OUT                (11 << 1)
+#define ATA_PROTO_UDMA_DATA_IN         (10 << 1)
+#define ATA_PROTO_DEVICE_RESET         (9 << 1)
+#define ATA_PROTO_DEVICE_DIAGNOSTIC    (8 << 1)
+#define ATA_PROTO_DMA_QUEUED           (7 << 1)
+#define ATA_PROTO_DMA                          (6 << 1)
+#define ATA_PROTO_PIO_DATA_OUT         (5 << 1)
+#define ATA_PROTO_PIO_DATA_IN          (4 << 1)
+#define ATA_PROTO_DATA_NONE                    (3 << 1)
+#define ATA_PROTO_SRST                         (1 << 1)
+#define ATA_PROTO_HRST                         (0 << 1)
+#define ATA_PROTO_EXTEND                       0x01
+               uchar_t         protocol;      // multiple count, protocol
+#define ATA_MCOUNT_MSK                         0xe0
+
+#define ATA_FLG_CK_COND                                0x20
+#define ATA_FLG_T_DIR                          0x08            // data from device
+#define ATA_FLG_BYT_BLOK                       0x04
+#define ATA_FLG_TLEN_STPSIU                    0x03
+#define ATA_FLG_TLEN_SECTOR_COUNT      0x02
+#define ATA_FLG_TLEN_FEATURE           0x01
+               uchar_t         flags;
+
+               uchar_t         efeatures;
+               uchar_t         features;
+               uchar_t         esector_count;
+               uchar_t         sector_count;
+               uchar_t         elba_low;
+               uchar_t         lba_low;
+               uchar_t         elba_mid;
+               uchar_t         lba_mid;
+               uchar_t         elba_high;
+               uchar_t         lba_high;
+               uchar_t         device;
+               uchar_t         command;
+               uchar_t         control;
+       } ata_pass_thru_;
+//----------------------------------------------------------------------------------------------------------
+#define SENSE_DATA_FMT_DESCRIPTOR      0x02
+
+// Fixed Format Sense Data Structure
+// Note: The field "error" has the following format:
+//        bit    7     - Address valid bit
+//               bits 6-4  - Error class
+//               bits 3-0  - Error code 
+//
+// Error classes 0-6 are vendor unique and also indicate that the
+// sense data is in _nonextended_ format. (i.e. not usually used)
+//             struct _scsi_nonextended_sense {
+//                     uchar_t sd_err;
+//                     ulong_t sd_block_address;
+//             };
+//
+//     An error class of 7 and an error code of 0 (70H) indicate SCSI-1
+//     extended sense data format (or SCSI-2 sense data format).
+//
+//     An error class of 7 and an error code of 1 (71H) indicate SCSI-2
+//     deferred errors.
+//
+//     Error codes 74H to 7EH are reserved and error code 7FH indicates
+//     a vendor-specific sense data format.
+typedef struct _scsi_sense {
+       uchar_t         error;                          // Error Code
+       uchar_t         segment;                        // Segment number
+       uchar_t         sense;                          // Sense key/flags
+       uchar_t         info[4];                        // Information (32bit big-endian value)
+       uchar_t         asl;                            // Additional Sense Length
+       uchar_t         csinfo[4];                      // Command-Specific Information
+       uchar_t         asc;                            // Additional Sense Code
+       uchar_t         ascq;                           // Additional Sense Code Qualifier
+       uchar_t         fruc;                           // Field Replaceable Unit Code
+       uchar_t         sks;                            // Sense Key Specific
+       ushort_t        sks_data;                       // Sense Key Specific Data (16bit big-endian)
+       ushort_t        asb;                            // Additional Sense uchar_ts (Max 256-18)
+} SCSI_SENSE;
+
+// Descriptor Format Sense Data Structure
+//     error code of 72 current, 73 deferred
+//     extended sense data format (or SCSI-2 sense data format).
+typedef struct _scsi_sense_descriptor {
+       uchar_t         error;                          // Error Code
+       uchar_t         sense;                          // Sense key/flags
+       uchar_t         asc;                            // Additional Sense Code
+       uchar_t         ascq;                           // Additional Sense Code Qualifier
+       uchar_t         rsvd[3];
+       uchar_t         asl;                            // Additional Sense Length
+} SCSI_SENSE_DESCRIPTOR;
+
+typedef struct _scsi_sense_desriptor_header {
+       uchar_t                 descriptor_type;
+       uchar_t                 descriptor_len;
+} SCSI_SENSE_DESCRIPTOR_HEADER;
+
+#define SENSE_DTYPE_INFORMATION                0x00
+#define SENSE_DTYPE_CSI                                0x01    // Command Specific Information
+#define SENSE_DTYPE_SKS                                0x02    // Sense Key Specific
+#define SENSE_DTYPE_FRU                                0x03    // Field Replaceable Unit
+#define SENSE_DTYPE_STREAM                     0x04
+#define SENSE_DTYPE_BLOCK                      0x05
+#define SENSE_DTYPE_OSD_OBJ_IDENT      0x06    // OSD Object Identification
+#define SENSE_DTYPE_OSD_INTEGRITY      0x07    // OSD Response Integrity Check Value
+#define SENSE_DTYPE_OSD_ATR_IDENT      0x08    // OSD Attribute Identification
+#define SENSE_DTYPE_ATA                                0x09
+
+typedef struct _ata_status_descriptor {
+       uchar_t                 descriptor_type;
+#define ATA_SD_DLEN                                    0x0c
+       uchar_t                 descriptor_len;                 /* 0xc */
+#define ATA_SD_FLG_EXTEND                      0x01
+       uchar_t                 flags;
+       uchar_t                 error;
+       uchar_t                 esector_count;                  /* (15:8) */
+       uchar_t                 sector_count;                   /* (7:0) */
+       uchar_t                 elba_low;                               /* (15:8) */
+       uchar_t                 lba_low;                                /* (7:0) */
+       uchar_t                 elba_mid;                               /* (15:8) */
+       uchar_t                 lba_mid;                                /* (7:0) */
+       uchar_t                 elba_high;                              /* (15:8) */
+       uchar_t                 lba_high;                               /* (7:0) */
+       uchar_t                 device;
+       uchar_t                 status;
+} ATA_STATUS_DESCRIPTOR;
+
+//----------------------------------------------------------------------------------------------------------
+// Sense Keys
+#define SK_MSK                 0x0F    // mask to sd_sense field for key
+
+#define SK_NO_SENSE            0               // No sense data (no error)
+               #define ASCQ_FILEMARK_DETECTED                  0x01
+               #define ASCQ_EOPM_DETECTED                              0x02    // End of Partition/Medium Detected
+               #define ASCQ_SETMARK_DETECTED                   0x03
+               #define ASCQ_BOPM_DETECTED                              0x04    // Beginning of Partition/Medium Detected
+
+#define SK_RECOVERED   1               // Recovered error
+               #define ASC_ATA_PASS_THRU                                       0x00
+                       #define ASCQ_ATA_PASS_THRU_INFO_AVAIL   0x1d
+
+#define SK_NOT_RDY             2               // Device not ready
+       #define ASC_NO_SEEK_COMPLETE                            0x02
+       #define ASC_NOT_READY                                           0x04
+               #define ASCQ_CAUSE_NOT_REPORTABLE                       0x00
+               #define ASCQ_BECOMING_READY                                     0x01
+               #define ASCQ_INIT_COMMAND_REQUIRED                      0x02
+               #define ASCQ_MANUAL_INTERVENTION_REQUIRED       0x03
+               #define ASCQ_FORMAT_IN_PROGRESS                         0x04
+               #define ASCQ_UNKNOWN_CHANGED                            0xff    // NTO extension for fdc's
+       #define ASC_MEDIA_FORMAT                                        0x30            // bad format
+       #define ASC_MEDIA_NOT_PRESENT                           0x3a
+       #define ASC_NOT_CONFIGURED                                      0x3e
+
+#define SK_MEDIUM              3               // Medium error
+       #define ASC_UNRECOVERABLE_READ_ERROR    0x11
+       #define ASC_RECORD_NOT_FOUND                    0x14
+               #define ASCQ_RECORD_NOT_FOUND           0x01
+       #define ASC_UNABLE_TO_RECOVER_TOC               0x57
+       #define ASC_INCOMPATIBLE_MEDIUM                 0x64
+
+#define SK_HARDWARE            4               // Hardware error
+       #define ASC_INTERNAL_TARGET_FAILURE             0x44
+       #define ASC_MEDIA_LOAD_EJECT_FAILURE    0x53
+               #define ASCQ_UNRECOVERABLE_CIRC                         0x06
+
+#define SK_ILLEGAL             5               // Illegal Request (bad command)
+       #define ASC_INVALID_COMMAND                     0x20
+       #define ASC_INVALID_FIELD                       0x24
+       #define ASC_INVALID_FIELD_PARAMETER     0x26
+       #define ASC_COMMAND_SEQUENCE_ERROR      0x2c
+               #define ASCQ_READ_SCRAMBLED             0x03
+       #define ASC_ILLEGAL_MODE                        0x64
+       #define ASC_COPY_PROTECTION                     0x6f
+
+#define SK_UNIT_ATN            6               // Unit Attention
+       #define ASC_MEDIUM_CHANGED                                      0x28
+       #define ASC_BUS_RESET                                           0x29
+       #define ASC_INSUFFICIENT_TIME_FOR_OPERATION     0x2e
+       #define ASC_OPERATOR_REQUEST                            0x5a
+               #define ASCQ_OPERATOR_MEDIUM_REMOVAL    0x01
+
+#define SK_DATA_PROT   7               // Data Protect
+       #define ASC_WRITE_PROTECTED                     0x27
+
+#define SK_BLNK_CHK            8               // Blank Check
+#define SK_VENDOR              9               // Vendor Specific
+#define SK_CPY_ABORT   10              // Copy Aborted
+#define SK_CMD_ABORT   11              // Aborted Command
+#define SK_EQUAL               12              // Equal
+#define SK_VOL_OFL             13              // Volume Overflow
+#define SK_MISCMP              14              // Miscompare
+#define SK_RESERVED            15              // Reserved
+//----------------------------------------------------------------------------------------------------------
+// Command Descriptor Block structure definitions
+
+// CDB Flags
+#define CF_LINK                        0x01    // Linked-command indication
+#define CF_FLAG                        0x02    // Linked-command with flag bit
+#define CF_VENDOR0             0x40    // Vendor unique bits
+#define CF_VENDOR1             0x80
+
+#define CF_FUA                 0x08
+#define CF_DPO                 0x10
+
+typedef union _cdb {
+       // generic 6 byte command descriptor block
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         lba_byte1;
+               uchar_t         lba_byte0;                              // LSB
+               uchar_t         transfer_len;
+               uchar_t         control;
+       } gen6;
+
+       // generic 10 byte command descriptor block
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         lba_byte3;
+               uchar_t         lba_byte4;
+               uchar_t         lba_byte1;
+               uchar_t         lba_byte0;
+               uchar_t         rsvd;
+               uchar_t         transfer_len[2];
+               uchar_t         control;
+       } gen10;
+
+       // generic 12 byte command descriptor block
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         lba_byte3;
+               uchar_t         lba_byte4;
+               uchar_t         lba_byte1;
+               uchar_t         lba_byte0;
+               uchar_t         transfer_len[4];
+               uchar_t         rsvd10;
+               uchar_t         control;
+       } gen12;
+
+       struct _format_unit {
+        uchar_t         op_code;
+#define FU_RSVD0        0xc0                    // reserved bits
+#define FU_FMTDAT       0x10
+#define FU_CMPLIST      0x08
+        uchar_t         defect_list_fmt;
+        uchar_t         track_num;
+        ushort_t        interleave;
+        uchar_t         rsvd1[7];
+       } format_unit;
+
+       struct _format_unit_old {
+        uchar_t         op_code;
+        uchar_t         rsvd0;
+        uchar_t         medium_type_code;
+        uchar_t         rsvd1;
+        uchar_t         interleave;
+        uchar_t         rsvd2;
+#define FMT_RSVD3               0x80
+#define FMT_SECT_SIZE_CD        0x70
+#define FMT_IMMED               0x08
+#define FMT_HEAD                0x04
+#define FMT_ST                  0x02
+#define FMT_CERT                0x01
+        uchar_t         cert;
+        uchar_t         track_addr;
+        uchar_t         rsvd4[4];
+       } format_unit_old;
+
+#define RW_OPT_RELADR  0x01
+#define RW_OPT_CORRCT  0x02                                    // Disable Corrections
+#define RW_OPT_FUA             0x08                                    // Force Unit Access
+#define RW_OPT_DPO             0x10                                    // Disable Page Out
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_lba;
+               uchar_t         lba[2];
+               uchar_t         transfer_len;
+               uchar_t         control;
+       } read_write6;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         lba[4];
+               uchar_t         rsvd2;
+               uchar_t         transfer_len[2];
+               uchar_t         control;
+       } read_write10;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         lba[4];
+               uchar_t         transfer_len[4];
+               uchar_t         rsvd2;
+               uchar_t         control;
+       } read_write12;
+
+#define MSEL_OPT_PF            0x10                    // Page Format
+#define MSEL_OPT_SP            0x01                    // Save Page
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+               uchar_t         param_length;
+               uchar_t         control;
+       } mode_select;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+               uchar_t         rsvd4;
+               uchar_t         rsvd5;
+               uchar_t         rsvd6;
+               uchar_t         param_length[2];
+               uchar_t         control;
+       } mode_select10;
+
+       struct {
+               uchar_t         opcode;
+#define LS_OPT_SP              0x01                    // Save Parameters
+#define LS_OPT_PCR             0x02                    // Parameter Code Reset
+               uchar_t         lun_opt;
+#define LS_PC_CUR_THRESHOLD            0x00
+#define LS_PC_CUR_CUMULATIVE   0x01
+#define LS_PC_DFLT_THRESHOLD   0x02
+#define LS_PC_DFLT_CUMULATIVE  0x03
+               uchar_t         pc;                                     // Page Control
+               uchar_t         rsvd3;
+               uchar_t         rsvd4;
+               uchar_t         rsvd5;
+               uchar_t         rsvd6;
+               uchar_t         param_length[2];
+               uchar_t         control;
+       } log_select;
+
+       struct {
+               uchar_t         opcode;
+#define MSNS_OPT_DBD   0x08                    // Disable Block Descriptors
+               uchar_t         lun_opt;
+#define PC_CURRENT             0x00
+#define PC_CHANGEABLE  0x40
+#define PC_DEFAULT             0x80
+#define PC_SAVED               0xC0
+#define PC_MSK                 0xC0
+               uchar_t         pc_page;
+               uchar_t         subpage;
+               uchar_t         allocation_length;
+               uchar_t         control;
+       } mode_sense;
+
+       struct _mode_sense10 {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         pc_page;
+               uchar_t         subpage;
+               uchar_t         rsvd4;
+               uchar_t         rsvd5;
+               uchar_t         rsvd6;
+               uchar_t         allocation_length[2];
+               uchar_t         control;
+       } mode_sense10;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         pc_page;
+               uchar_t         rsvd3;
+               uchar_t         rsvd4;
+               uchar_t         parameter_pointer[2];
+               uchar_t         allocation_length[2];
+               uchar_t         control;
+       } log_sense;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+               uchar_t         prevent;
+               uchar_t         control;
+       } removal;
+
+       struct {
+               uchar_t         opcode;
+#define LD_OPT_IMMED   0x01
+               uchar_t         lun_opt;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+#define LD_CMD_START   0x01
+#define LD_CMD_LOEJ            0x02
+#define LD_CMD_STOP            0x00
+#define LD_CMD_EJECT   0x02
+#define LD_CMD_LOAD            0x03
+
+// Sequential-Access
+#define LD_CMD_SA_HOLD         0x08
+#define LD_CMD_SA_EOT          0x04
+#define LD_CMD_SA_RT           0x02                    // re-tension
+#define LD_CMD_SA_LOEJ         0x01
+
+// Block
+#define LD_CMD_PC_MSK          0xf0
+#define LD_CMD_PC_NC           0
+#define LD_CMD_PC_ACTIVE       1
+#define LD_CMD_PC_IDLE         2
+#define LD_CMD_PC_STANDBY      3
+#define LD_CMD_PC_SLEEP                5
+
+               uchar_t         cmd;
+               uchar_t         control;
+       } load;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+#define SC_OPT_RELADR  0x01
+#define SC_OPT_IMMED   0x02
+               uchar_t         lba[4];
+               uchar_t         num_blocks[2];
+               uchar_t         control;
+       } synchronize_cache;
+
+// cdrom commands
+       struct {
+               uchar_t         opcode;
+               uchar_t         rsvd1;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+               uchar_t         rsvd4;
+               uchar_t         rsvd5;
+               uchar_t         rsvd6;
+               uchar_t         allocation_length[2];
+               uchar_t         control;
+       } read_disc_information;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+               uchar_t         rsvd4;
+               uchar_t         rsvd5;
+               uchar_t         rsvd6;
+               uchar_t         rsvd7;
+               uchar_t         resume;
+               uchar_t         control;
+       } pause_resume;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         rsvd2;
+               uchar_t         start_minute;
+               uchar_t         start_second;
+               uchar_t         start_frame;
+               uchar_t         end_minute;
+               uchar_t         end_second;
+               uchar_t         end_frame;
+               uchar_t         control;
+       } play_audio_msf;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+               uchar_t         start_track;
+               uchar_t         start_index;
+               uchar_t         rsvd6;
+               uchar_t         end_track;
+               uchar_t         end_index;
+               uchar_t         control;
+       } play_audio_ti;
+
+       struct {
+               uchar_t         opcode;
+#define CD_SCAN_DIR_FORWARD            0x00
+#define CD_SCAN_DIR_REVERSE            0x10
+               uchar_t         opt;
+               uchar_t         start_address[4];
+#define CD_SCAN_TYPE_LBA               0x00
+#define CD_SCAN_TYPE_MSF               0x40
+#define CD_SCAN_TYPE_TRK               0x80
+#define CD_SCAN_TYPE_MSK               0xc0
+               uchar_t         rsvd6;
+               uchar_t         rsvd7;
+               uchar_t         rsvd8;
+               uchar_t         type;
+               uchar_t         rsvd10;
+               uchar_t         rsvd11;
+       } cd_scan;
+
+       struct {
+               uchar_t         opcode;
+#define RTOC_OPT_MSF   0x02
+               uchar_t         lun_opt;
+#define RTOC_FMT_TOC           0x0
+#define RTOC_FMT_SESSION       0x1
+#define RTOC_FMT_QSUBCODE      0x2
+#define RTOC_FMT_QSUBCHNL      0x3
+#define RTOC_FMT_ATIP          0x4
+#define RTOC_FMT_CDTEXT                0x5
+               uchar_t         format;
+               uchar_t         rsvd3;
+               uchar_t         rsvd4;
+               uchar_t         rsvd5;
+               uchar_t         start_track;
+               uchar_t         allocation_length[2];
+#define RTOC_CNTL_FMT_SESSION  0x40
+               uchar_t         control_format;
+       } read_toc;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         rsvd2[6];
+               uchar_t         allocation_length[2];
+               uchar_t         rsvd3[2];
+       } mechanism_status;
+
+       struct {
+               uchar_t         opcode;
+#define EXCHANGE_OPT_IMMED     0x01
+               uchar_t         lun_opt;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+#define EXCHANGE_CMD_START     0x01
+#define EXCHANGE_CMD_LOEJ      0x02
+               uchar_t         cmd;
+               uchar_t         rsvd5;
+               uchar_t         rsvd6;
+               uchar_t         rsvd7;
+               uchar_t         slot;
+               uchar_t         rsvd9;
+               uchar_t         rsvd10;
+               uchar_t         rsvd11;
+       } exchange;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         rt;
+               uchar_t         feature_number[2];
+               uchar_t         rsvd4;
+               uchar_t         rsvd5;
+               uchar_t         rsvd6;
+               uchar_t         allocation_length[2];
+               uchar_t         control;
+       } get_configuration;
+
+       struct {
+               uchar_t         opcode;
+#define GE_OPT_POLLED                  0x01
+               uchar_t         opt;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+#define NCR_OPERATIONAL_CHANGE 0x02
+#define NCR_POWER_MANAGEMENT   0x04
+#define NCR_EXTERNAL_REQUEST   0x08
+#define NCR_MEDIA                              0x10
+#define NCR_MULTI_INITIATOR            0x20
+#define NCR_DEVICE_BUSY                        0x40
+               uchar_t         ncr;         // notification class request
+               uchar_t         rsvd5;
+               uchar_t         rsvd6;
+               uchar_t         allocation_length[2];
+               uchar_t         control;
+       } get_event;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         rsvd2;
+               uchar_t         rsvd3;
+               uchar_t         rsvd4;
+               uchar_t         rsvd5;
+               uchar_t         rsvd6;
+               uchar_t         allocation_length[2];
+               uchar_t         control;
+       } read_formated_capacities;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         read_speed[2];
+               uchar_t         write_speed[2];
+               uchar_t         rsvd2[6];
+       } cd_speed;             
+
+       struct {
+               uchar_t         opcode;
+#define RSCHNL_OPT_MSF         0x02
+               uchar_t         lun_opt;
+#define RSCHNL_DATA_SUBQ       0x40
+               uchar_t         data;
+               uchar_t         data_format;
+               uchar_t         rsvd4;
+               uchar_t         rsvd5;
+               uchar_t         track;
+               uchar_t         allocation_length[2];
+               uchar_t         control;
+       } read_subchannel;
+
+#define CD_FRAME_SYNC_SIZE         12
+#define CD_FRAME_HDR_SIZE           4
+#define CD_FRAME_SUB_HDR_SIZE       8
+#define CD_FRAME_EDC_SIZE           4
+#define CD_FRAME_ECC_SIZE         276
+#define CD_FRAME_AUX_SIZE           8
+#define CD_FRAME_ZERO_SIZE          8
+#define CD_FRAME_SPARE_SIZE         4
+#define CD_FRAME_C2_ERR_SIZE      294
+#define CD_FRAME_BLOCK_ERR_SIZE     2
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_stype;
+// expected sector type
+#define RDCD_EST_ANY_SECTOR                            (0 << 2)
+#define RDCD_EST_CDDA_SECTOR                   (1 << 2)
+#define RDCD_EST_YELLOW_MODE1_SECTOR   (2 << 2)
+#define RDCD_EST_YELLOW_MODE2_SECTOR   (3 << 2)
+#define RDCD_EST_XA_SECTOR                             (4 << 2)
+#define RDCD_EST_XA_FORM2_SECTOR               (5 << 2)
+#define RDCD_EST_MSK                                   (7 << 2)
+               uchar_t         lba[4];
+               uchar_t         transfer_len[3];
+               uchar_t         flags;
+#define RDCD_FLG_SYNC                  0x80
+#define RDCD_FLG_UDATA                 0x10
+#define RDCD_FLG_ECC                   0x08
+#define RDCD_FLG_CD_ERR                        0x02
+#define RDCD_FLG_CD_BLOCK_ERR  0x04
+#define RDCD_FLG_HC_NONE               ( 0x00 << 5 )
+#define RDCD_FLG_HC_HDR                        ( 0x01 << 5 )
+#define RDCD_FLG_HC_SUBHEADER  ( 0x02 << 5 )
+#define RDCD_FLG_HC_ALL_HEADERS        ( 0x03 << 5 )
+               uchar_t         subch_selection;
+               uchar_t         rsvd3;
+       } read_cd;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_stype;
+               uchar_t         rsvd2;
+               uchar_t         start_minute;
+               uchar_t         start_second;
+               uchar_t         start_frame;
+               uchar_t         end_minute;
+               uchar_t         end_second;
+               uchar_t         end_frame;
+               uchar_t         flags;
+               uchar_t         subch_selection;
+               uchar_t         rsvd11;
+       } read_cd_msf;
+
+       struct _ata_pass_thru {
+               uchar_t         opcode;
+#define ATA_PROTO_MSK                          0x1e
+#define ATA_PROTO_RESPONSE                     (15 << 1)
+#define ATA_PROTO_FPDMA                                (12 << 1)
+#define ATA_PROTO_UDMA_DATA_OUT                (11 << 1)
+#define ATA_PROTO_UDMA_DATA_IN         (10 << 1)
+#define ATA_PROTO_DEVICE_RESET         (9 << 1)
+#define ATA_PROTO_DEVICE_DIAGNOSTIC    (8 << 1)
+#define ATA_PROTO_DMA_QUEUED           (7 << 1)
+#define ATA_PROTO_DMA                          (6 << 1)
+#define ATA_PROTO_PIO_DATA_OUT         (5 << 1)
+#define ATA_PROTO_PIO_DATA_IN          (4 << 1)
+#define ATA_PROTO_DATA_NONE                    (3 << 1)
+#define ATA_PROTO_SRST                         (1 << 1)
+#define ATA_PROTO_HRST                         (0 << 1)
+#define ATA_PROTO_EXTEND                       0x01
+               uchar_t         protocol;      // multiple count, protocol
+#define ATA_MCOUNT_MSK                         0xe0
+
+#define ATA_FLG_CK_COND                                0x20
+#define ATA_FLG_T_DIR                          0x08            // data from device
+#define ATA_FLG_BYT_BLOK                       0x04
+#define ATA_FLG_TLEN_STPSIU                    0x03
+#define ATA_FLG_TLEN_SECTOR_COUNT      0x02
+#define ATA_FLG_TLEN_FEATURE           0x01
+               uchar_t         flags;
+
+               uchar_t         efeatures;
+               uchar_t         features;
+               uchar_t         esector_count;
+               uchar_t         sector_count;
+               uchar_t         elba_low;
+               uchar_t         lba_low;
+               uchar_t         elba_mid;
+               uchar_t         lba_mid;
+               uchar_t         elba_high;
+               uchar_t         lba_high;
+               uchar_t         device;
+               uchar_t         command;
+               uchar_t         control;
+       } ata_pass_thru;
+
+// sequential access commands
+       struct {
+               uchar_t         opcode;
+#define ERASE_OPT_LONG 0x01
+               uchar_t         opt;
+               uchar_t         rsvd[3];
+               uchar_t         control;
+       } erase;
+
+       struct {
+               uchar_t         opcode;
+#define LOCATE_OPT_CP  0x2
+#define LOCATE_OPT_BT  0x4
+               uchar_t         opt;
+               uchar_t         rsvd2;
+               uchar_t         ba[4];                  // block address
+               uchar_t         rsvd7;
+               uchar_t         partition;
+               uchar_t         control;
+       } locate;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         opt;
+               uchar_t         rsvd2[3];
+               uchar_t         control;
+       } read_block_limits;
+
+#define RP_OPT_BT      0x01                    // block address type
+#define RP_OPT_LNG     0x02                    // long format
+#define RP_OPT_TCLP    0x04                    // total current logical position
+       struct {
+               uchar_t         opcode;
+               uchar_t         lun_opt;
+               uchar_t         rsvd2[7];
+               uchar_t         control;
+       } read_position;
+
+#define SRW_OPT_FIXED  0x01
+#define SRW_OPT_SILI   0x02
+       struct {
+               uchar_t         opcode;
+               uchar_t         opt;
+               uchar_t         transfer_len[3];
+               uchar_t         control;
+       } sa_read_write;
+
+       struct {
+               uchar_t         opcode;
+               uchar_t         opt;
+               uchar_t         rsvd[3];
+               uchar_t         control;
+       } rewind;
+
+       struct {
+               uchar_t         opcode;
+#define SPACE_CODE_BLOCKS              0x00
+#define SPACE_CODE_FMRKS               0x01
+#define SPACE_CODE_SEQ_FMRKS   0x02
+#define SPACE_CODE_EOD                 0x03
+#define SPACE_CODE_SMRKS               0x04
+#define SPACE_CODE_SEQ_SMRKS   0x05
+               uchar_t         lun_code;
+               uchar_t         count[3];
+               uchar_t         control;
+       } space;
+
+       struct {
+               uchar_t         opcode;
+#define WF_OPT_IMMED   0x01
+#define WF_OPT_WSMK            0x02
+               uchar_t         opt;
+               uchar_t         transfer_length[3];
+               uchar_t         control;
+       } write_filemarks;
+
+       struct {
+               uchar_t         opcode;
+#define RD_OPT_MEDIA   0x01
+               uchar_t         opt;
+               uchar_t         rsvd[5];
+               uchar_t         allocation_length[2];
+               uchar_t         control;
+       } report_density;
+
+       struct {
+               uchar_t         opcode;
+#define FM_OPT_IMMED   0x01
+#define FM_OPT_VERIFY  0x02
+               uchar_t         opt;
+#define FM_FMT_DFLT                            0x00
+#define FM_FMT_PARTITION               0x01
+#define FM_FMT_FORMAT_PARTITION        0x02
+               uchar_t         format;
+               uchar_t         transfer_length[2];
+               uchar_t         control;
+       } format_media;
+} CDB;
+//----------------------------------------------------------------------------------------------------------
+
+struct _ata_sense
+ {
+  SCSI_SENSE_DESCRIPTOR               sense;
+  ATA_STATUS_DESCRIPTOR               desc;
+ };
+//----------------------------------------------------------------------------------------------------------
+
+
+#endif /* OS_QNXNTO_H_ */
index 980ed161476a0bb571caf223fde6f9940a9ea46a..8f8db65e678638e188e55427b731b036392e6089 100644 (file)
@@ -39,9 +39,9 @@
 
 extern long long bytes;
 
-static const char *filenameandversion="$Id: os_solaris.cpp,v 1.28 2006/08/25 06:06:25 sxzzsf Exp $";
+static const char *filenameandversion="$Id: os_solaris.cpp,v 1.29 2007/05/09 19:01:32 dpgilbert Exp $";
 
-const char *os_XXXX_c_cvsid="$Id: os_solaris.cpp,v 1.28 2006/08/25 06:06:25 sxzzsf Exp $" \
+const char *os_XXXX_c_cvsid="$Id: os_solaris.cpp,v 1.29 2007/05/09 19:01:32 dpgilbert Exp $" \
 ATACMDS_H_CVSID CONFIG_H_CVSID INT64_H_CVSID OS_SOLARIS_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 // The printwarning() function warns about unimplemented functions
@@ -369,37 +369,35 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
 #include <sys/scsi/impl/uscsi.h>
 
 // Interface to SCSI devices.  See os_linux.c
-int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report) {
+int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
+{
   struct uscsi_cmd uscsi;
 
-    if (report > 0) {
-        int k;
-        const unsigned char * ucp = iop->cmnd;
-        const char * np;
-
-        np = scsi_get_opcode_name(ucp[0]);
-        pout(" [%s: ", np ? np : "<unknown opcode>");
-        for (k = 0; k < (int)iop->cmnd_len; ++k)
-            pout("%02x ", ucp[k]);
-        if ((report > 1) && 
-            (DXFER_TO_DEVICE == iop->dxfer_dir) && (iop->dxferp)) {
-            int trunc = (iop->dxfer_len > 256) ? 1 : 0;
-
-            pout("]\n  Outgoing data, len=%d%s:\n", (int)iop->dxfer_len,
-                 (trunc ? " [only first 256 bytes shown]" : ""));
-            dStrHex((char *)iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
-        }
-        else
-            pout("]");
+  if (report > 0) {
+    int k;
+    const unsigned char * ucp = iop->cmnd;
+    const char * np;
+
+    np = scsi_get_opcode_name(ucp[0]);
+    pout(" [%s: ", np ? np : "<unknown opcode>");
+    for (k = 0; k < (int)iop->cmnd_len; ++k)
+      pout("%02x ", ucp[k]);
+    pout("]\n");
+    if ((report > 1) && 
+        (DXFER_TO_DEVICE == iop->dxfer_dir) && (iop->dxferp)) {
+      int trunc = (iop->dxfer_len > 256) ? 1 : 0;
+
+      pout("  Outgoing data, len=%d%s:\n", (int)iop->dxfer_len,
+           (trunc ? " [only first 256 bytes shown]" : ""));
+      dStrHex((char *)iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
     }
-
-
+  }
   memset(&uscsi, 0, sizeof (uscsi));
 
   uscsi.uscsi_cdb = reinterpret_cast<char*>(iop->cmnd);
   uscsi.uscsi_cdblen = iop->cmnd_len;
   if (iop->timeout == 0)
-    uscsi.uscsi_timeout = 60; /* XXX */
+    uscsi.uscsi_timeout = 60; /* 60 seconds */
   else
     uscsi.uscsi_timeout = iop->timeout;
   uscsi.uscsi_bufaddr = reinterpret_cast<char*>(iop->dxferp);
@@ -418,23 +416,46 @@ int do_scsi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report) {
   default:
     return -EINVAL;
   }
-  uscsi.uscsi_flags |= USCSI_ISOLATE;
+  uscsi.uscsi_flags |= (USCSI_ISOLATE | USCSI_RQENABLE);
 
-  if (ioctl(fd, USCSICMD, &uscsi))
-    return -errno;
+  if (ioctl(fd, USCSICMD, &uscsi)) {
+    int err = errno;
+
+    if (! ((EIO == err) && uscsi.uscsi_status))
+      return -err;
+    /* errno is set to EIO when a non-zero SCSI completion status given */
+  }
 
   iop->scsi_status = uscsi.uscsi_status;
   iop->resid = uscsi.uscsi_resid;
   iop->resp_sense_len = iop->max_sense_len - uscsi.uscsi_rqresid;
 
   if (report > 0) {
-    int trunc = (iop->dxfer_len > 256) ? 1 : 0;
-    pout("  status=0\n");
-    
-    pout("  Incoming data, len=%d%s:\n", (int)iop->dxfer_len,
-         (trunc ? " [only first 256 bytes shown]" : ""));
-    dStrHex((char *)iop->dxferp, (trunc ? 256 : iop->dxfer_len) , 1);
+    int trunc;
+    int len = iop->resp_sense_len;
+
+    if ((SCSI_STATUS_CHECK_CONDITION == iop->scsi_status) &&
+        iop->sensep && (len > 3)) {
+      pout("  status=0x%x: sense_key=0x%x asc=0x%x ascq=0x%x\n", 
+           iop->scsi_status, iop->sensep[2] & 0xf,
+           iop->sensep[12], iop->sensep[13]);
+      if (report > 1) {
+          pout("  >>> Sense buffer, len=%d:\n", len);
+          dStrHex((const char *)iop->sensep, ((len > 252) ? 252 : len) , 1);
+        }
+    } else if (iop->scsi_status)
+      pout("  status=%x\n", iop->scsi_status);
+    if (iop->resid)
+      pout("  dxfer_len=%d, resid=%d\n", iop->dxfer_len, iop->resid);
+    if (report > 1) {
+      len = iop->dxfer_len - iop->resid;
+      if (len > 0) {
+        trunc = (len > 256) ? 1 : 0;
+        pout("  Incoming data, len=%d%s:\n", len,
+             (trunc ? " [only first 256 bytes shown]" : ""));
+        dStrHex((char *)iop->dxferp, (trunc ? 256 : len) , 1);
+      }
+    }
   }
-
-  return (0);
+  return 0;
 }
index 6652c95bbd86222ac5a685e797882f232aacd45b..0b4694d22858730ebc6790ac2237f913876f6925 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2004-6 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2004-7 Christian Franke <smartmontools-support@lists.sourceforge.net>
  *
  * 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
@@ -36,8 +36,6 @@ extern int64_t bytes; // malloc() byte count
 #include <stddef.h> // offsetof()
 #include <io.h> // access()
 
-#define ARGUSED(x) ((void)(x))
-
 // Macro to check constants at compile time using a dummy typedef
 #define ASSERT_CONST(c, n) \
   typedef char assert_const_##c[((c) == (n)) ? 1 : -1]
@@ -46,10 +44,33 @@ extern int64_t bytes; // malloc() byte count
 
 
 // Needed by '-V' option (CVS versioning) of smartd/smartctl
-const char *os_XXXX_c_cvsid="$Id: os_win32.cpp,v 1.50 2006/11/15 22:48:04 chrfranke Exp $"
+const char *os_XXXX_c_cvsid="$Id: os_win32.cpp,v 1.59 2007/10/31 22:08:04 chrfranke Exp $"
 ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 
+// Running on Win9x/ME ?
+static inline bool is_win9x()
+{
+       return !!(GetVersion() & 0x80000000);
+}
+
+// Running on 64-bit Windows as 32-bit app ?
+static bool is_wow64()
+{
+       HMODULE hk = GetModuleHandleA("kernel32");
+       if (!hk)
+               return false;
+       BOOL (WINAPI * IsWow64Process_p)(HANDLE, PBOOL) =
+               (BOOL (WINAPI *)(HANDLE, PBOOL))GetProcAddress(hk, "IsWow64Process");
+       if (!IsWow64Process_p)
+               return false;
+       BOOL w64 = FALSE;
+       if (!IsWow64Process_p(GetCurrentProcess(), &w64))
+               return false;
+       return !!w64;
+}
+
+
 #ifndef HAVE_GET_OS_VERSION_STR
 #error define of HAVE_GET_OS_VERSION_STR missing in config.h
 #endif
@@ -57,19 +78,16 @@ ATACMDS_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSICMDS_H_CVSID UTI
 // Return build host and OS version as static string
 const char * get_os_version_str()
 {
-       static char vstr[sizeof(SMARTMONTOOLS_BUILD_HOST)-3-1+sizeof("-2003r2-sp2.1")+13];
+       static char vstr[sizeof(SMARTMONTOOLS_BUILD_HOST)-3-1+sizeof("-2003r2(64)-sp2.1")+13];
        char * const vptr = vstr+sizeof(SMARTMONTOOLS_BUILD_HOST)-3-1;
        const int vlen = sizeof(vstr)-(sizeof(SMARTMONTOOLS_BUILD_HOST)-3);
 
-       OSVERSIONINFOEXA vi;
-       const char * w;
-
        // remove "-pc" to avoid long lines
        assert(!strncmp(SMARTMONTOOLS_BUILD_HOST+5, "pc-", 3));
        strcpy(vstr, "i686-"); strcpy(vstr+5, SMARTMONTOOLS_BUILD_HOST+5+3);
        assert(vptr == vstr+strlen(vstr) && vptr+vlen+1 == vstr+sizeof(vstr));
 
-       memset(&vi, 0, sizeof(vi));
+       OSVERSIONINFOEXA vi; memset(&vi, 0, sizeof(vi));
        vi.dwOSVersionInfoSize = sizeof(vi);
        if (!GetVersionExA((OSVERSIONINFOA *)&vi)) {
                memset(&vi, 0, sizeof(vi));
@@ -81,6 +99,7 @@ const char * get_os_version_str()
        if (vi.dwPlatformId > 0xff || vi.dwMajorVersion > 0xff || vi.dwMinorVersion > 0xff)
                return vstr;
 
+       const char * w;
        switch (vi.dwPlatformId << 16 | vi.dwMajorVersion << 8 | vi.dwMinorVersion) {
          case VER_PLATFORM_WIN32_WINDOWS<<16|0x0400| 0:
                w = (vi.szCSDVersion[1] == 'B' ||
@@ -101,24 +120,29 @@ const char * get_os_version_str()
          default: w = 0; break;
        }
 
+       const char * w64 = (is_wow64() ? "(64)" : "");
        if (!w)
-               snprintf(vptr, vlen, "-%s%lu.%lu",
+               snprintf(vptr, vlen, "-%s%lu.%lu%s",
                        (vi.dwPlatformId==VER_PLATFORM_WIN32_NT ? "nt" : "9x"),
-                       vi.dwMajorVersion, vi.dwMinorVersion);
+                       vi.dwMajorVersion, vi.dwMinorVersion, w64);
        else if (vi.wServicePackMinor)
-               snprintf(vptr, vlen, "-%s-sp%u.%u", w, vi.wServicePackMajor, vi.wServicePackMinor);
+               snprintf(vptr, vlen, "-%s%s-sp%u.%u", w, w64, vi.wServicePackMajor, vi.wServicePackMinor);
        else if (vi.wServicePackMajor)
-               snprintf(vptr, vlen, "-%s-sp%u", w, vi.wServicePackMajor);
+               snprintf(vptr, vlen, "-%s%s-sp%u", w, w64, vi.wServicePackMajor);
        else
-               snprintf(vptr, vlen, "-%s", w);
+               snprintf(vptr, vlen, "-%s%s", w, w64);
        return vstr;
 }
 
 
+static int get_phy_drive_type(int drive);
+static int get_log_drive_type(int drive);
+
 #define ATARAID_FDOFFSET 0x0200
 
-static int ata_open(int drive, const char * options, int port);
+static int ata_open(int phydrive, int logdrive, const char * options, int port);
 static void ata_close(int fd);
+static int ata_scan_win9x(unsigned long * drives);
 static int ata_scan(unsigned long * drives, int * rdriveno, unsigned long * rdrives);
 static const char * ata_get_def_options(void);
 
@@ -135,8 +159,9 @@ static int aspi_scan(unsigned long * drives);
 
 #define SPT_FDOFFSET 0x0400
 
-static int spt_open(int pd_num, int tape_num, int sub_addr);
+static int spt_open(int pd_num, int ld_num, int tape_num, int sub_addr);
 static void spt_close(int fd);
+static int spt_scan(unsigned long * drives);
 
 
 static int is_permissive()
@@ -149,9 +174,22 @@ static int is_permissive()
        return 1;
 }
 
+// return number for drive letter, -1 on error
+// "[A-Za-z]:([/\\][.]?)?" => 0-25
+// Accepts trailing '"' to fix broken "X:\" parameter passing from .bat files
+static int drive_letter(const char * s)
+{
+       return (   (('A' <= s[0] && s[0] <= 'Z') || ('a' <= s[0] && s[0] <= 'z'))
+               && s[1] == ':'
+               && (!s[2] || (   strchr("/\\\"", s[2])
+                             && (!s[3] || (s[3] == '.' && !s[4])))              ) ?
+               (s[0] & 0x1f) - 1 : -1);
+}
+
+// Skip trailing "/dev/", do not allow "/dev/X:"
 static const char * skipdev(const char * s)
 {
-       return (!strncmp(s, "/dev/", 5) ? s + 5 : s);
+       return (!strncmp(s, "/dev/", 5) && drive_letter(s+5) < 0 ? s+5 : s);
 }
 
 
@@ -160,18 +198,31 @@ static const char * skipdev(const char * s)
 int guess_device_type (const char * dev_name)
 {
        dev_name = skipdev(dev_name);
+       if (!strncmp(dev_name, "scsi", 4))
+               return CONTROLLER_SCSI;
+       if (is_win9x())
+               return CONTROLLER_ATA;
        if (!strncmp(dev_name, "hd", 2))
                return CONTROLLER_ATA;
        if (!strncmp(dev_name, "tw_cli", 6))
                return CONTROLLER_ATA;
-       if (!strncmp(dev_name, "scsi", 4))
-               return CONTROLLER_SCSI;
-       if (!strncmp(dev_name, "sd", 2))
+       if (!strncmp(dev_name, "st", 2))
                return CONTROLLER_SCSI;
-       if (!strncmp(dev_name, "pd", 2))
+       if (!strncmp(dev_name, "nst", 3))
                return CONTROLLER_SCSI;
        if (!strncmp(dev_name, "tape", 4))
                return CONTROLLER_SCSI;
+       int logdrive = drive_letter(dev_name);
+       if (logdrive >= 0) {
+               int type = get_log_drive_type(logdrive);
+               return (type != CONTROLLER_UNKNOWN ? type : CONTROLLER_SCSI);
+       }
+       char drive[1+1] = "";
+       if (sscanf(dev_name, "sd%1[a-z]", drive) == 1)
+               return get_phy_drive_type(drive[0]-'a');
+       int phydrive = -1;
+       if (sscanf(dev_name, "pd%d", &phydrive) == 1 && phydrive >= 0)
+               return get_phy_drive_type(phydrive);
        return CONTROLLER_UNKNOWN;
 }
 
@@ -192,17 +243,32 @@ int make_device_names (char*** devlist, const char* type)
        rdriveno[0] = rdriveno[1] = -1;
        rdrives[0] = rdrives[1] = 0;
        
+       bool win9x = is_win9x();
        if (!strcmp(type, "ATA")) {
                // bit i set => drive i present
-               n = ata_scan(drives, rdriveno, rdrives);
-               path = "/dev/hda";
+               if (win9x) {
+                       n = ata_scan_win9x(drives);
+                       path = "/dev/hda";
+               }
+               else {
+                       n = ata_scan(drives, rdriveno, rdrives);
+                       path = "/dev/sda";
+               }
                nmax = 10;
        }
        else if (!strcmp(type, "SCSI")) {
-               // bit i set => drive with ID (i & 0x7) on adapter (i >> 3) present
-               n = aspi_scan(drives);
-               path = "/dev/scsi00";
-               nmax = 10*8;
+               if (win9x) {
+                       // bit i set => drive with ID (i & 0x7) on adapter (i >> 3) present
+                       n = aspi_scan(drives);
+                       path = "/dev/scsi00";
+                       nmax = 10*8;
+               }
+               else {
+                       // bit i set => drive i present
+                       n = spt_scan(drives);
+                       path = "/dev/sda";
+                       nmax = 10;
+               }
        }
        else
                return -1;
@@ -227,7 +293,7 @@ int make_device_names (char*** devlist, const char* type)
                                if (!(rdrives[ci] & (1L << pi)))
                                        continue;
                                char rpath[20];
-                               sprintf(rpath, "/dev/hd%c,%u", 'a'+j, pi);
+                               sprintf(rpath, "/dev/sd%c,%u", 'a'+j, pi);
                                sz = strlen(rpath)+1;
                                char * s = (char *)malloc(sz); bytes += sz;
                                strcpy(s, rpath);
@@ -267,18 +333,29 @@ int deviceopen(const char * pathname, char *type)
        int len = strlen(pathname);
 
        if (!strcmp(type, "ATA")) {
-               // hd[a-j](:[saicp]+)? => ATA 0-9 with options
-               char drive[1+1] = "", options[5+1] = ""; int n1 = -1, n2 = -1;
-               if (   sscanf(pathname, "hd%1[a-j]%n:%5[saicp]%n", drive, &n1, options, &n2) >= 1
-                   && ((n1 == len && !options[0]) || n2 == len)                                 ) {
-                       return ata_open(drive[0] - 'a', options, -1);
+               // [sh]d[a-z](:[saicp]+)? => Physical drive 0-25, with options
+               char drive[1+1] = "", options[7+1] = ""; int n1 = -1, n2 = -1;
+               if (   sscanf(pathname, "%*[sh]d%1[a-z]%n:%6[saicmp]%n", drive, &n1, options, &n2) >= 1
+                   && ((n1 == len && !options[0]) || n2 == len)                                       ) {
+                       return ata_open(drive[0] - 'a', -1, options, -1);
                }
-               // hd[a-j],N(:[saicp]+)? => Physical drive 0-9, RAID port N, with options
+               // [sh]d[a-z],N(:[saicp]+)? => Physical drive 0-25, RAID port N, with options
                drive[0] = 0; options[0] = 0; n1 = -1; n2 = -1;
                unsigned port = ~0;
-               if (   sscanf(pathname, "hd%1[a-j],%u%n:%5[saicp]%n", drive, &port, &n1, options, &n2) >= 2
-                   && port < 32 && ((n1 == len && !options[0]) || n2 == len)                              ) {
-                       return ata_open(drive[0] - 'a', options, port);
+               if (   sscanf(pathname, "%*[sh]d%1[a-z],%u%n:%7[saicmp3]%n", drive, &port, &n1, options, &n2) >= 2
+                   && port < 32 && ((n1 == len && !options[0]) || n2 == len)                                     ) {
+                       return ata_open(drive[0] - 'a', -1, options, port);
+               }
+               // pd<m>,N => Physical drive <m>, RAID port N
+               int phydrive = -1; port = ~0; n1 = -1; n2 = -1;
+               if (   sscanf(pathname, "pd%d%n,%u%n", &phydrive, &n1, &port, &n2) >= 1
+                   && phydrive >= 0 && ((n1 == len && (int)port < 0) || (n2 == len && port < 32))) {
+                       return ata_open(phydrive, -1, "", (int)port);
+               }
+               // [a-zA-Z]: => Physical drive behind logical drive 0-25
+               int logdrive = drive_letter(pathname);
+               if (logdrive >= 0) {
+                       return ata_open(-1, logdrive, "", -1);
                }
                // tw_cli/... => Parse tw_cli output
                if (!strncmp(pathname, "tw_cli/", 7)) {
@@ -290,22 +367,36 @@ int deviceopen(const char * pathname, char *type)
                if (sscanf(pathname,"scsi%1u%1x%n", &adapter, &id, &n1) == 2 && n1 == len) {
                        return aspi_open(adapter, id);
                }
-               // sd[a-z],N => Physical drive 0-26, RAID port N
+               // sd[a-z],N => Physical drive 0-25, RAID port N
                char drive[1+1] = ""; int sub_addr = -1; n1 = -1; int n2 = -1;
                if (   sscanf(pathname, "sd%1[a-z]%n,%d%n", drive, &n1, &sub_addr, &n2) >= 1
                    && ((n1 == len && sub_addr == -1) || (n2 == len && sub_addr >= 0))      ) {
-                       return spt_open(drive[0] - 'a', -1, sub_addr);
+                       return spt_open(drive[0] - 'a', -1, -1, sub_addr);
                }
                // pd<m>,N => Physical drive <m>, RAID port N
                int pd_num = -1; sub_addr = -1; n1 = -1; n2 = -1;
                if (   sscanf(pathname, "pd%d%n,%d%n", &pd_num, &n1, &sub_addr, &n2) >= 1
                    && pd_num >= 0 && ((n1 == len && sub_addr == -1) || (n2 == len && sub_addr >= 0))) {
-                       return spt_open(pd_num, -1, sub_addr);
+                       return spt_open(pd_num, -1, -1, sub_addr);
                }
-               // tape<m> => tape drive <m>
+               // [a-zA-Z]: => Physical drive behind logical drive 0-25
+               int logdrive = drive_letter(pathname);
+               if (logdrive >= 0) {
+                       return spt_open(-1, logdrive, -1, -1);
+               }
+               // n?st<m> => tape drive <m> (same names used in Cygwin's /dev emulation)
                int tape_num = -1; n1 = -1;
+               if (sscanf(pathname, "st%d%n", &tape_num, &n1) == 1 && tape_num >= 0 && n1 == len) {
+                       return spt_open(-1, -1, tape_num, -1);
+               }
+               tape_num = -1; n1 = -1;
+               if (sscanf(pathname, "nst%d%n", &tape_num, &n1) == 1 && tape_num >= 0 && n1 == len) {
+                       return spt_open(-1, -1, tape_num, -1);
+               }
+               // tape<m> => tape drive <m>
+               tape_num = -1; n1 = -1;
                if (sscanf(pathname, "tape%d%n", &tape_num, &n1) == 1 && tape_num >= 0 && n1 == len) {
-                       return spt_open(-1, tape_num, -1);
+                       return spt_open(-1, -1, tape_num, -1);
                }
        }
 
@@ -360,9 +451,10 @@ void print_smartctl_examples(){
          "            (Prints Attributes for 3ware controller 0, port 1 using tw_cli)\n"
          "\n"
          "  ATA SMART access methods and ordering may be specified by modifiers\n"
-         "  following the device name: /dev/hdX:[saic], where\n"
+         "  following the device name: /dev/hdX:[saicm], where\n"
          "  's': SMART_* IOCTLs,         'a': IOCTL_ATA_PASS_THROUGH,\n"
-         "  'i': IOCTL_IDE_PASS_THROUGH, 'c': ATA via IOCTL_SCSI_PASS_THROUGH.\n"
+         "  'i': IOCTL_IDE_PASS_THROUGH, 'c': ATA via IOCTL_SCSI_PASS_THROUGH,\n"
+         "  'm': IOCTL_SCSI_MINIPORT_*.\n"
          "  The default on this system is /dev/hdX:%s\n", ata_get_def_options()
   );
 }
@@ -374,9 +466,6 @@ void print_smartctl_examples(){
 
 // SMART_* IOCTLs, also known as DFP_* (Disk Fault Protection)
 
-// Deklarations from:
-// http://cvs.sourceforge.net/viewcvs.py/mingw/w32api/include/ddk/ntdddisk.h?rev=1.3
-
 #define FILE_READ_ACCESS       0x0001
 #define FILE_WRITE_ACCESS      0x0002
 #define METHOD_BUFFERED             0
@@ -504,7 +593,7 @@ ASSERT_SIZEOF(SENDCMDOUTPARAMS, 16+1);
 
 static void print_ide_regs(const IDEREGS * r, int out)
 {
-       pout("%s=0x%02x,%s=0x%02x, SC=0x%02x, NS=0x%02x, CL=0x%02x, CH=0x%02x, SEL=0x%02x\n",
+       pout("%s=0x%02x,%s=0x%02x, SC=0x%02x, SN=0x%02x, CL=0x%02x, CH=0x%02x, SEL=0x%02x\n",
        (out?"STS":"CMD"), r->bCommandReg, (out?"ERR":" FR"), r->bFeaturesReg,
        r->bSectorCountReg, r->bSectorNumberReg, r->bCylLowReg, r->bCylHighReg, r->bDriveHeadReg);
 }
@@ -521,13 +610,12 @@ static void print_ide_regs_io(const IDEREGS * ri, const IDEREGS * ro)
 
 // call SMART_GET_VERSION, return device map or -1 on error
 
-static int smart_get_version(HANDLE hdevice, unsigned long * portmap = 0)
+static int smart_get_version(HANDLE hdevice, GETVERSIONINPARAMS_EX * ata_version_ex = 0)
 {
-       GETVERSIONOUTPARAMS vers;
+       GETVERSIONOUTPARAMS vers; memset(&vers, 0, sizeof(vers));
        const GETVERSIONINPARAMS_EX & vers_ex = (const GETVERSIONINPARAMS_EX &)vers;
        DWORD num_out;
 
-       memset(&vers, 0, sizeof(vers));
        if (!DeviceIoControl(hdevice, SMART_GET_VERSION,
                NULL, 0, &vers, sizeof(vers), &num_out, NULL)) {
                if (con->reportataioctl)
@@ -537,17 +625,6 @@ static int smart_get_version(HANDLE hdevice, unsigned long * portmap = 0)
        }
        assert(num_out == sizeof(GETVERSIONOUTPARAMS));
 
-       if (portmap) {
-               // Return bitmask of valid RAID ports
-               if (vers_ex.wIdentifier != SMART_VENDOR_3WARE) {
-                       pout("  SMART_GET_VERSION returns unknown Identifier = %04x\n"
-                                "  This is no 3ware 9000 controller or driver has no SMART support.\n", vers_ex.wIdentifier);
-                       errno = ENOENT;
-                       return -1;
-               }
-               *portmap = vers_ex.dwDeviceMapEx;
-       }
-
        if (con->reportataioctl > 1) {
                pout("  SMART_GET_VERSION suceeded, bytes returned: %lu\n"
                     "    Vers = %d.%d, Caps = 0x%lx, DeviceMap = 0x%02x\n",
@@ -558,6 +635,9 @@ static int smart_get_version(HANDLE hdevice, unsigned long * portmap = 0)
                        vers_ex.wIdentifier, vers_ex.wControllerId, vers_ex.dwDeviceMapEx);
        }
 
+       if (ata_version_ex)
+               *ata_version_ex = vers_ex;
+
        // TODO: Check vers.fCapabilities here?
        return vers.bIDEDeviceMap;
 }
@@ -595,11 +675,9 @@ static int smart_ioctl(HANDLE hdevice, int drive, IDEREGS * regs, char * data, u
        }
        else {
                code = SMART_SEND_DRIVE_COMMAND; name = "SMART_SEND_DRIVE_COMMAND";
-               if (regs->bFeaturesReg == ATA_SMART_STATUS) {
+               if (regs->bFeaturesReg == ATA_SMART_STATUS)
                        size_out = sizeof(IDEREGS); // ioctl returns new IDEREGS as data
                        // Note: cBufferSize must be 0 on Win9x
-                       inpar.cBufferSize = size_out;
-               }
                else
                        size_out = 0;
        }
@@ -614,8 +692,9 @@ static int smart_ioctl(HANDLE hdevice, int drive, IDEREGS * regs, char * data, u
                        pout("  %s failed, Error=%ld\n", name, err);
                        print_ide_regs_io(regs, NULL);
                }
-               errno = (   err == ERROR_INVALID_FUNCTION /*9x*/
-                        || err == ERROR_INVALID_PARAMETER/*NT/2K/XP*/ ? ENOSYS : EIO);
+               errno = (   err == ERROR_INVALID_FUNCTION/*9x*/
+                        || err == ERROR_INVALID_PARAMETER/*NT/2K/XP*/
+                        || err == ERROR_NOT_SUPPORTED ? ENOSYS : EIO);
                return -1;
        }
        // NOTE: On Win9x, inpar.irDriveRegs now contains the returned regs
@@ -714,7 +793,7 @@ static int ide_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, u
                        print_ide_regs_io(regs, NULL);
                }
                VirtualFree(buf, 0, MEM_RELEASE);
-               errno = (err == ERROR_INVALID_FUNCTION ? ENOSYS : EIO);
+               errno = (err == ERROR_INVALID_FUNCTION || err == ERROR_NOT_SUPPORTED ? ENOSYS : EIO);
                return -1;
        }
 
@@ -848,7 +927,7 @@ static int ata_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, i
                        pout("  IOCTL_ATA_PASS_THROUGH failed, Error=%ld\n", err);
                        print_ide_regs_io(regs, NULL);
                }
-               errno = (err == ERROR_INVALID_FUNCTION ? ENOSYS : EIO);
+               errno = (err == ERROR_INVALID_FUNCTION || err == ERROR_NOT_SUPPORTED ? ENOSYS : EIO);
                return -1;
        }
 
@@ -890,9 +969,6 @@ static int ata_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, i
 
 // ATA PASS THROUGH via SCSI PASS THROUGH (WinNT4 only)
 
-// Declarations from:
-// http://cvs.sourceforge.net/viewcvs.py/mingw/w32api/include/ddk/ntddscsi.h?rev=1.2
-
 #define IOCTL_SCSI_PASS_THROUGH \
        CTL_CODE(IOCTL_SCSI_BASE, 0x0401, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
 
@@ -976,7 +1052,7 @@ static int ata_via_scsi_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char
                long err = GetLastError();
                if (con->reportataioctl)
                        pout("  ATA via IOCTL_SCSI_PASS_THROUGH failed, Error=%ld\n", err);
-               errno = (err == ERROR_INVALID_FUNCTION ? ENOSYS : EIO);
+               errno = (err == ERROR_INVALID_FUNCTION || err == ERROR_NOT_SUPPORTED ? ENOSYS : EIO);
                return -1;
        }
 
@@ -1006,7 +1082,12 @@ static int ata_via_scsi_pass_through_ioctl(HANDLE hdevice, IDEREGS * regs, char
 
 /////////////////////////////////////////////////////////////////////////////
 
-// ATA PASS THROUGH via 3ware specific SCSI MINIPORT ioctl
+// SMART IOCTL via SCSI MINIPORT ioctl
+
+// This function is handled by ATAPI port driver (atapi.sys) or by SCSI
+// miniport driver (via SCSI port driver scsiport.sys).
+// It can be used to skip the missing or broken handling of some SMART
+// command codes (e.g. READ_LOG) in the disk class driver (disk.sys)
 
 #define IOCTL_SCSI_MINIPORT \
        CTL_CODE(IOCTL_SCSI_BASE, 0x0402, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
@@ -1024,8 +1105,155 @@ typedef struct _SRB_IO_CONTROL {
 
 ASSERT_SIZEOF(SRB_IO_CONTROL, 28);
 
+#define FILE_DEVICE_SCSI 0x001b
+
+#define IOCTL_SCSI_MINIPORT_SMART_VERSION               ((FILE_DEVICE_SCSI << 16) + 0x0500)
+#define IOCTL_SCSI_MINIPORT_IDENTIFY                    ((FILE_DEVICE_SCSI << 16) + 0x0501)
+#define IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS          ((FILE_DEVICE_SCSI << 16) + 0x0502)
+#define IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS       ((FILE_DEVICE_SCSI << 16) + 0x0503)
+#define IOCTL_SCSI_MINIPORT_ENABLE_SMART                ((FILE_DEVICE_SCSI << 16) + 0x0504)
+#define IOCTL_SCSI_MINIPORT_DISABLE_SMART               ((FILE_DEVICE_SCSI << 16) + 0x0505)
+#define IOCTL_SCSI_MINIPORT_RETURN_STATUS               ((FILE_DEVICE_SCSI << 16) + 0x0506)
+#define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE     ((FILE_DEVICE_SCSI << 16) + 0x0507)
+#define IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES       ((FILE_DEVICE_SCSI << 16) + 0x0508)
+#define IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS       ((FILE_DEVICE_SCSI << 16) + 0x0509)
+#define IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE ((FILE_DEVICE_SCSI << 16) + 0x050a)
+#define IOCTL_SCSI_MINIPORT_READ_SMART_LOG              ((FILE_DEVICE_SCSI << 16) + 0x050b)
+#define IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG             ((FILE_DEVICE_SCSI << 16) + 0x050c)
+
+/////////////////////////////////////////////////////////////////////////////
+
+static int ata_via_scsi_miniport_smart_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, int datasize)
+{
+       // Select code
+       DWORD code = 0; const char * name = 0;
+       if (regs->bCommandReg == ATA_IDENTIFY_DEVICE) {
+               code = IOCTL_SCSI_MINIPORT_IDENTIFY; name = "IDENTIFY";
+       }
+       else if (regs->bCommandReg == ATA_SMART_CMD) switch (regs->bFeaturesReg) {
+         case ATA_SMART_READ_VALUES:
+               code = IOCTL_SCSI_MINIPORT_READ_SMART_ATTRIBS; name = "READ_SMART_ATTRIBS"; break;
+         case ATA_SMART_READ_THRESHOLDS:
+               code = IOCTL_SCSI_MINIPORT_READ_SMART_THRESHOLDS; name = "READ_SMART_THRESHOLDS"; break;
+         case ATA_SMART_ENABLE:
+               code = IOCTL_SCSI_MINIPORT_ENABLE_SMART; name = "ENABLE_SMART"; break;
+         case ATA_SMART_DISABLE:
+               code = IOCTL_SCSI_MINIPORT_DISABLE_SMART; name = "DISABLE_SMART"; break;
+         case ATA_SMART_STATUS:
+               code = IOCTL_SCSI_MINIPORT_RETURN_STATUS; name = "RETURN_STATUS"; break;
+         case ATA_SMART_AUTOSAVE:
+               code = IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTOSAVE; name = "ENABLE_DISABLE_AUTOSAVE"; break;
+       //case ATA_SMART_SAVE: // obsolete since ATA-6, not used by smartmontools
+       //      code = IOCTL_SCSI_MINIPORT_SAVE_ATTRIBUTE_VALUES; name = "SAVE_ATTRIBUTE_VALUES"; break;
+         case ATA_SMART_IMMEDIATE_OFFLINE:
+               code = IOCTL_SCSI_MINIPORT_EXECUTE_OFFLINE_DIAGS; name = "EXECUTE_OFFLINE_DIAGS"; break;
+         case ATA_SMART_AUTO_OFFLINE:
+               code = IOCTL_SCSI_MINIPORT_ENABLE_DISABLE_AUTO_OFFLINE; name = "ENABLE_DISABLE_AUTO_OFFLINE"; break;
+         case ATA_SMART_READ_LOG_SECTOR:
+               code = IOCTL_SCSI_MINIPORT_READ_SMART_LOG; name = "READ_SMART_LOG"; break;
+         case ATA_SMART_WRITE_LOG_SECTOR:
+               code = IOCTL_SCSI_MINIPORT_WRITE_SMART_LOG; name = "WRITE_SMART_LOG"; break;
+       }
+       if (!code) {
+               errno = ENOSYS;
+               return -1;
+       }
+
+       // Set SRB
+       struct {
+               SRB_IO_CONTROL srbc;
+               union {
+                       SENDCMDINPARAMS in;
+                       SENDCMDOUTPARAMS out;
+               } params;
+               char space[512-1];
+       } sb;
+       ASSERT_SIZEOF(sb, sizeof(SRB_IO_CONTROL)+sizeof(SENDCMDINPARAMS)-1+512);
+       memset(&sb, 0, sizeof(sb));
+
+       unsigned size;
+       if (datasize > 0) {
+               if (datasize > (int)sizeof(sb.space)+1) {
+                       errno = EINVAL;
+                       return -1;
+               }
+               size = datasize;
+       }
+       else if (datasize < 0) {
+               if (-datasize > (int)sizeof(sb.space)+1) {
+                       errno = EINVAL;
+                       return -1;
+               }
+               size = -datasize;
+               memcpy(sb.params.in.bBuffer, data, size);
+       }
+       else if (code == IOCTL_SCSI_MINIPORT_RETURN_STATUS)
+               size = sizeof(IDEREGS);
+       else
+               size = 0;
+       sb.srbc.HeaderLength = sizeof(SRB_IO_CONTROL);
+       memcpy(sb.srbc.Signature, "SCSIDISK", 8); // atapi.sys
+       sb.srbc.Timeout = 60; // seconds
+       sb.srbc.ControlCode = code;
+       //sb.srbc.ReturnCode = 0;
+       sb.srbc.Length = sizeof(SENDCMDINPARAMS)-1 + size;
+       sb.params.in.irDriveRegs = *regs;
+       sb.params.in.cBufferSize = size;
+
+       // Call miniport ioctl
+       size += sizeof(SRB_IO_CONTROL) + sizeof(SENDCMDINPARAMS)-1;
+       DWORD num_out;
+       if (!DeviceIoControl(hdevice, IOCTL_SCSI_MINIPORT,
+               &sb, size, &sb, size, &num_out, NULL)) {
+               long err = GetLastError();
+               if (con->reportataioctl) {
+                       pout("  IOCTL_SCSI_MINIPORT_%s failed, Error=%ld\n", name, err);
+                       print_ide_regs_io(regs, NULL);
+               }
+               errno = (err == ERROR_INVALID_FUNCTION || err == ERROR_NOT_SUPPORTED ? ENOSYS : EIO);
+               return -1;
+       }
+
+       // Check result
+       if (sb.srbc.ReturnCode) {
+               if (con->reportataioctl) {
+                       pout("  IOCTL_SCSI_MINIPORT_%s failed, ReturnCode=0x%08lx\n", name, sb.srbc.ReturnCode);
+                       print_ide_regs_io(regs, NULL);
+               }
+               errno = EIO;
+               return -1;
+       }
+
+       if (sb.params.out.DriverStatus.bDriverError) {
+               if (con->reportataioctl) {
+                       pout("  IOCTL_SCSI_MINIPORT_%s failed, DriverError=0x%02x, IDEError=0x%02x\n", name,
+                               sb.params.out.DriverStatus.bDriverError, sb.params.out.DriverStatus.bIDEError);
+                       print_ide_regs_io(regs, NULL);
+               }
+               errno = (!sb.params.out.DriverStatus.bIDEError ? ENOSYS : EIO);
+               return -1;
+       }
+
+       if (con->reportataioctl > 1) {
+               pout("  IOCTL_SCSI_MINIPORT_%s suceeded, bytes returned: %lu (buffer %lu)\n", name,
+                       num_out, sb.params.out.cBufferSize);
+               print_ide_regs_io(regs, (code == IOCTL_SCSI_MINIPORT_RETURN_STATUS ?
+                                        (const IDEREGS *)(sb.params.out.bBuffer) : 0));
+       }
+
+       if (datasize > 0)
+               memcpy(data, sb.params.out.bBuffer, datasize);
+       else if (datasize == 0 && code == IOCTL_SCSI_MINIPORT_RETURN_STATUS)
+               *regs = *(const IDEREGS *)(sb.params.out.bBuffer);
+
+       return 0;
+}
+
+
 /////////////////////////////////////////////////////////////////////////////
 
+// ATA PASS THROUGH via 3ware specific SCSI MINIPORT ioctl
+
 static int ata_via_3ware_miniport_ioctl(HANDLE hdevice, IDEREGS * regs, char * data, int datasize, int port)
 {
        struct {
@@ -1384,6 +1612,180 @@ static int tw_cli_command_interface(smart_command_set command, int /*select*/, c
 }
 
 
+/////////////////////////////////////////////////////////////////////////////
+
+// IOCTL_STORAGE_QUERY_PROPERTY
+
+#define FILE_DEVICE_MASS_STORAGE    0x0000002d
+#define IOCTL_STORAGE_BASE          FILE_DEVICE_MASS_STORAGE
+#define FILE_ANY_ACCESS             0
+
+#define IOCTL_STORAGE_QUERY_PROPERTY \
+       CTL_CODE(IOCTL_STORAGE_BASE, 0x0500, METHOD_BUFFERED, FILE_ANY_ACCESS)
+
+typedef enum _STORAGE_BUS_TYPE {
+       BusTypeUnknown      = 0x00,
+       BusTypeScsi         = 0x01,
+       BusTypeAtapi        = 0x02,
+       BusTypeAta          = 0x03,
+       BusType1394         = 0x04,
+       BusTypeSsa          = 0x05,
+       BusTypeFibre        = 0x06,
+       BusTypeUsb          = 0x07,
+       BusTypeRAID         = 0x08,
+       BusTypeiScsi        = 0x09,
+       BusTypeSas          = 0x0A,
+       BusTypeSata         = 0x0B,
+       BusTypeSd           = 0x0C,
+       BusTypeMmc          = 0x0D,
+       BusTypeMax          = 0x0E,
+       BusTypeMaxReserved  = 0x7F
+} STORAGE_BUS_TYPE, *PSTORAGE_BUS_TYPE;
+
+typedef struct _STORAGE_DEVICE_DESCRIPTOR {
+       ULONG Version;
+       ULONG Size;
+       UCHAR DeviceType;
+       UCHAR DeviceTypeModifier;
+       BOOLEAN RemovableMedia;
+       BOOLEAN CommandQueueing;
+       ULONG VendorIdOffset;
+       ULONG ProductIdOffset;
+       ULONG ProductRevisionOffset;
+       ULONG SerialNumberOffset;
+       STORAGE_BUS_TYPE BusType;
+       ULONG RawPropertiesLength;
+       UCHAR RawDeviceProperties[1];
+} STORAGE_DEVICE_DESCRIPTOR, *PSTORAGE_DEVICE_DESCRIPTOR;
+
+typedef enum _STORAGE_QUERY_TYPE {
+       PropertyStandardQuery = 0,
+       PropertyExistsQuery,
+       PropertyMaskQuery,
+       PropertyQueryMaxDefined
+} STORAGE_QUERY_TYPE, *PSTORAGE_QUERY_TYPE;
+
+typedef enum _STORAGE_PROPERTY_ID {
+       StorageDeviceProperty = 0,
+       StorageAdapterProperty,
+       StorageDeviceIdProperty,
+       StorageDeviceUniqueIdProperty,
+       StorageDeviceWriteCacheProperty,
+       StorageMiniportProperty,
+       StorageAccessAlignmentProperty
+} STORAGE_PROPERTY_ID, *PSTORAGE_PROPERTY_ID;
+
+typedef struct _STORAGE_PROPERTY_QUERY {
+       STORAGE_PROPERTY_ID PropertyId;
+       STORAGE_QUERY_TYPE QueryType;
+       UCHAR AdditionalParameters[1];
+} STORAGE_PROPERTY_QUERY, *PSTORAGE_PROPERTY_QUERY;
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+// Return STORAGE_BUS_TYPE for device, BusTypeUnknown on error.
+// (HANDLE does not need any access rights, therefore this works
+// without admin rights)
+
+static STORAGE_BUS_TYPE ioctl_get_storage_bus_type(HANDLE hdevice)
+{
+       STORAGE_PROPERTY_QUERY query = {StorageDeviceProperty, PropertyStandardQuery, 0};
+
+       union {
+               STORAGE_DEVICE_DESCRIPTOR dev;
+               char raw[256];
+       } prop;
+       memset(&prop, 0, sizeof(prop));
+
+       DWORD num_out;
+       if (!DeviceIoControl(hdevice, IOCTL_STORAGE_QUERY_PROPERTY,
+               &query, sizeof(query), &prop, sizeof(prop), &num_out, NULL)) {
+               if (con->reportataioctl > 1 || con->reportscsiioctl > 1)
+                       pout("  IOCTL_STORAGE_QUERY_PROPERTY failed, Error=%ld\n", GetLastError());
+               return BusTypeUnknown;
+       }
+
+       if (con->reportataioctl > 1 || con->reportscsiioctl > 1) {
+               pout("  IOCTL_STORAGE_QUERY_PROPERTY returns:\n"
+                    "    Vendor:   \"%s\"\n"
+                    "    Product:  \"%s\"\n"
+                    "    Revision: \"%s\"\n"
+                    "    Removable: %s\n"
+                    "    BusType:   0x%02x\n",
+                    (prop.dev.VendorIdOffset        ? prop.raw+prop.dev.VendorIdOffset : ""),
+                    (prop.dev.ProductIdOffset       ? prop.raw+prop.dev.ProductIdOffset : ""),
+                    (prop.dev.ProductRevisionOffset ? prop.raw+prop.dev.ProductRevisionOffset : ""),
+                    (prop.dev.RemovableMedia? "Yes":"No"), prop.dev.BusType
+               );
+       }
+       return prop.dev.BusType;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////
+
+// get CONTROLLER_* for open handle
+static int get_controller_type(HANDLE hdevice, GETVERSIONINPARAMS_EX * ata_version_ex = 0)
+{
+       // Try SMART_GET_VERSION first to detect ATA SMART support
+       // for drivers reporting BusTypeScsi (3ware)
+       if (smart_get_version(hdevice, ata_version_ex) >= 0)
+               return CONTROLLER_ATA;
+
+       STORAGE_BUS_TYPE type = ioctl_get_storage_bus_type(hdevice);
+       switch (type) {
+               case BusTypeAta:
+               case BusTypeSata:
+                       if (ata_version_ex)
+                               memset(ata_version_ex, 0, sizeof(*ata_version_ex));
+                       return CONTROLLER_ATA;
+               case BusTypeScsi:
+               case BusTypeiScsi:
+               case BusTypeSas:
+                       return CONTROLLER_SCSI;
+               default:
+                       return CONTROLLER_UNKNOWN;
+       }
+       /*NOTREACHED*/
+}
+
+// get CONTROLLER_* for device path
+static int get_controller_type(const char * path, GETVERSIONINPARAMS_EX * ata_version_ex = 0)
+{
+       HANDLE h = CreateFileA(path, GENERIC_READ|GENERIC_WRITE,
+               FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL);
+       if (h == INVALID_HANDLE_VALUE)
+               return CONTROLLER_UNKNOWN;
+       if (con->reportataioctl > 1 || con->reportscsiioctl > 1)
+               pout(" %s: successfully opened\n", path);
+       int type = get_controller_type(h, ata_version_ex);
+       CloseHandle(h);
+       return type;
+}
+
+// get CONTROLLER_* for physical drive number
+static int get_phy_drive_type(int drive, GETVERSIONINPARAMS_EX * ata_version_ex)
+{
+       char path[30];
+       snprintf(path, sizeof(path)-1, "\\\\.\\PhysicalDrive%d", drive);
+       return get_controller_type(path, ata_version_ex);
+}
+
+static int get_phy_drive_type(int drive)
+{
+       return get_phy_drive_type(drive, 0);
+}
+
+// get CONTROLLER_* for logical drive number
+static int get_log_drive_type(int drive)
+{
+       char path[30];
+       snprintf(path, sizeof(path)-1, "\\\\.\\%c:", 'A'+drive);
+       return get_controller_type(path);
+}
+
+
 /////////////////////////////////////////////////////////////////////////////
 
 // Call GetDevicePowerState() if available (Win98/ME/2000/XP/2003)
@@ -1450,9 +1852,11 @@ static int get_device_power_state(HANDLE hdevice)
 // TODO: Put in a struct indexed by fd (or better a C++ object of course ;-)
 static HANDLE h_ata_ioctl = 0;
 static const char * ata_def_options;
-static char * ata_cur_options;
+static char * ata_usr_options;
+const int max_ata_driveno = 25;
 static int ata_driveno; // Drive number
-static char ata_smartver_state[10]; // SMART_GET_VERSION: 0=unknown, 1=OK, 2=failed
+static int ata_driveno_is_log = -1; // 0=physical drivenumber, 1=logical drive number, -1=unknown
+static char ata_smartver_state[max_ata_driveno+1]; // SMART_GET_VERSION: 0=unknown, 1=OK, 2=failed
 
 // Print SMARTVSD error message, return errno
 
@@ -1512,37 +1916,44 @@ static const char * ata_get_def_options()
        else if ((ver & 0xff) == 4) // WinNT4
                return "sc"; // SMART_*, SCSI_PASS_THROUGH
        else // WinXP, 2003, Vista
-               return "psai"; // GetDevicePowerState(), SMART_*, ATA_, IDE_PASS_THROUGH
+               return "psaim"; // GetDevicePowerState(), SMART_*, ATA_, IDE_PASS_THROUGH, SCSI_MINIPORT_*
 }
 
 
 // Open ATA device
 
-static int ata_open(int drive, const char * options, int port)
+static int ata_open(int phydrive, int logdrive, const char * options, int port)
 {
-       int win9x;
-       char devpath[30];
-       int devmap;
-
        // TODO: This version does not allow to open more than 1 ATA devices
        if (h_ata_ioctl) {
                errno = ENFILE;
                return -1;
        }
 
-       win9x = ((GetVersion() & 0x80000000) != 0);
-
-       if (!(0 <= drive && drive <= (win9x ? 7 : 9))) {
-               errno = ENOENT;
+       // Using both physical and logical drive names (in smartd.conf) not supported yet
+       if (!(   ata_driveno_is_log < 0
+             || (phydrive >= 0 && !ata_driveno_is_log)
+             || (logdrive >= 0 &&  ata_driveno_is_log))) {
+               pout("Using both /dev/hdX and X: is not supported\n");
+               errno = EINVAL;
                return -1;
        }
 
        // path depends on Windows Version
-       if (win9x)
+       bool win9x = is_win9x();
+       char devpath[30];
+       if (win9x && 0 <= phydrive && phydrive <= 7)
                // Use patched "smartvse.vxd" for drives 4-7, see INSTALL file for details
-               strcpy(devpath, (drive <= 3 ? "\\\\.\\SMARTVSD" : "\\\\.\\SMARTVSE"));
-       else
-               snprintf(devpath, sizeof(devpath)-1, "\\\\.\\PhysicalDrive%d", drive);
+               strcpy(devpath, (phydrive <= 3 ? "\\\\.\\SMARTVSD" : "\\\\.\\SMARTVSE"));
+       else if (!win9x && 0 <= phydrive && phydrive <= max_ata_driveno)
+               snprintf(devpath, sizeof(devpath)-1, "\\\\.\\PhysicalDrive%d", phydrive);
+       else if (!win9x && 0 <= logdrive && logdrive <= max_ata_driveno) {
+               snprintf(devpath, sizeof(devpath)-1, "\\\\.\\%c:", 'A'+logdrive);
+       }
+       else {
+               errno = ENOENT;
+               return -1;
+       }
 
        // Open device
        if ((h_ata_ioctl = CreateFileA(devpath,
@@ -1551,7 +1962,7 @@ static int ata_open(int drive, const char * options, int port)
                long err = GetLastError();      
                pout("Cannot open device %s, Error=%ld\n", devpath, err);
                if (err == ERROR_FILE_NOT_FOUND)
-                       errno = (win9x && drive <= 3 ? smartvsd_error() : ENOENT);
+                       errno = (win9x && phydrive <= 3 ? smartvsd_error() : ENOENT);
                else if (err == ERROR_ACCESS_DENIED) {
                        if (!win9x)
                                pout("Administrator rights are necessary to access physical drives.\n");
@@ -1566,25 +1977,46 @@ static int ata_open(int drive, const char * options, int port)
        if (con->reportataioctl > 1)
                pout("%s: successfully opened\n", devpath);
 
-       // Save options
-       if (!*options) {
-               // Set default options according to Windows version
-               if (!ata_def_options)
-                       ata_def_options = ata_get_def_options();
-               options = (port < 0 ? ata_def_options : "s3"); // RAID: SMART_* and SCSI_MINIPORT
-       }
-       ata_cur_options = strdup(options);
+       // Set default options according to Windows version
+       if (!ata_def_options)
+               ata_def_options = ata_get_def_options();
+       // Save user options
+       if (port >= 0 && !*options)
+               options = "s3"; // RAID: SMART_* and SCSI_MINIPORT
+       assert(!ata_usr_options);
+       if (*options)
+               ata_usr_options = strdup(options);
 
        // NT4/2000/XP: SMART_GET_VERSION may spin up disk, so delay until first real SMART_* call
-       ata_driveno = drive;
+       if (phydrive >= 0) {
+               ata_driveno = phydrive; ata_driveno_is_log = 0;
+       }
+       else {
+               assert(logdrive >= 0);
+               ata_driveno = logdrive; ata_driveno_is_log = 1;
+       }
        if (!win9x && port < 0)
                return 0;
 
        // Win9X/ME: Get drive map
        // RAID: Get port map
+       GETVERSIONINPARAMS_EX vers_ex;
+       int devmap = smart_get_version(h_ata_ioctl, (port >= 0 ? &vers_ex : 0));
+
        unsigned long portmap = 0;
-       devmap = smart_get_version(h_ata_ioctl, (port >= 0 ? &portmap : 0));
+       if (port >= 0 && devmap >= 0) {
+               // 3ware RAID: check vendor id
+               if (vers_ex.wIdentifier != SMART_VENDOR_3WARE) {
+                       pout("SMART_GET_VERSION returns unknown Identifier = %04x\n"
+                            "This is no 3ware 9000 controller or driver has no SMART support.\n",
+                            vers_ex.wIdentifier);
+                       devmap = -1;
+               }
+               else
+                       portmap = vers_ex.dwDeviceMapEx;
+       }
        if (devmap < 0) {
+               pout("%s: ATA driver has no SMART support\n", devpath);
                if (!is_permissive()) {
                        ata_close(0);
                        errno = ENOSYS;
@@ -1592,15 +2024,15 @@ static int ata_open(int drive, const char * options, int port)
                }
                devmap = 0x0f;
        }
-       ata_smartver_state[drive] = 1;
+       ata_smartver_state[ata_driveno] = 1;
 
        if (port >= 0) {
                // 3ware RAID: update devicemap first
                if (!update_3ware_devicemap_ioctl(h_ata_ioctl)) {
-                       unsigned long portmap1 = 0;
-                       if (smart_get_version(h_ata_ioctl, &portmap1) >= 0)
-                               portmap = portmap1;
-               }       
+                       if (   smart_get_version(h_ata_ioctl, &vers_ex) >= 0
+                           && vers_ex.wIdentifier == SMART_VENDOR_3WARE    )
+                               portmap = vers_ex.dwDeviceMapEx;
+               }
                // Check port existence
                if (!(portmap & (1L << port))) {
                        pout("%s: Port %d is empty or does not exist\n", devpath, port);
@@ -1615,10 +2047,10 @@ static int ata_open(int drive, const char * options, int port)
        }
 
        // Win9x/ME: Check device presence & type
-       if (((devmap >> (drive & 0x3)) & 0x11) != 0x01) {
-               unsigned char atapi = (devmap >> (drive & 0x3)) & 0x10;
+       if (((devmap >> (ata_driveno & 0x3)) & 0x11) != 0x01) {
+               unsigned char atapi = (devmap >> (ata_driveno & 0x3)) & 0x10;
                pout("%s: Drive %d %s (IDEDeviceMap=0x%02x).\n", devpath,
-                    drive, (atapi?"is an ATAPI device":"does not exist"), devmap);
+                    ata_driveno, (atapi?"is an ATAPI device":"does not exist"), devmap);
                // Win9x drive existence check may not work as expected
                // The atapi.sys driver incorrectly fills in the bIDEDeviceMap with 0x01
                // (The related KB Article Q196120 is no longer available)
@@ -1629,81 +2061,58 @@ static int ata_open(int drive, const char * options, int port)
                }
        }
        // Use drive number as fd for ioctl
-       return (drive & 0x3);
+       return (ata_driveno & 0x3);
 }
 
 
-static void ata_close(int fd)
+static void ata_close(int /*fd*/)
 {
-       ARGUSED(fd);
        CloseHandle(h_ata_ioctl);
        h_ata_ioctl = 0;
-       if (ata_cur_options) {
-               free(ata_cur_options);
-               ata_cur_options = 0;
+       if (ata_usr_options) {
+               free(ata_usr_options);
+               ata_usr_options = 0;
        }
 }
 
 
-// Scan for ATA drives, fill bitmask of drives present, return #drives
+// Scan for ATA drives on Win9x/ME, fill bitmask of drives present, return #drives
 
-static int ata_scan(unsigned long * drives, int * rdriveno, unsigned long * rdrives)
+static int ata_scan_win9x(unsigned long * drives)
 {
-       int win9x = ((GetVersion() & 0x80000000) != 0);
-       int cnt = 0, i;
-
-       for (i = 0; i <= 9; i++) {
-               char devpath[30];
-               GETVERSIONOUTPARAMS vers;
-               const GETVERSIONINPARAMS_EX & vers_ex = (const GETVERSIONINPARAMS_EX &)vers;
-               DWORD num_out;
-               HANDLE h;
-               if (win9x)
-                       strcpy(devpath, "\\\\.\\SMARTVSD");
-               else
-                       snprintf(devpath, sizeof(devpath)-1, "\\\\.\\PhysicalDrive%d", i);
-
-               // Open device
-               if ((h = CreateFileA(devpath,
-                       GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE,
-                       NULL, OPEN_EXISTING, 0, 0)) == INVALID_HANDLE_VALUE) {
-                       if (con->reportataioctl > 1)
-                               pout(" %s: Open failed, Error=%ld\n", devpath, GetLastError());
-                       if (win9x)
-                               break; // SMARTVSD.VXD missing or no ATA devices
-                       continue; // Disk not found or access denied (break;?)
-               }
-
-               // Get drive map
-               memset(&vers, 0, sizeof(vers));
-               if (!DeviceIoControl(h, SMART_GET_VERSION,
-                       NULL, 0, &vers, sizeof(vers), &num_out, NULL)) {
-                       if (con->reportataioctl)
-                               pout(" %s: SMART_GET_VERSION failed, Error=%ld\n", devpath, GetLastError());
-                       CloseHandle(h);
-                       if (win9x)
-                               break; // Should not happen
-                       continue; // Non ATA disk or no SMART ioctl support (possibly SCSI disk)
-               }
-               CloseHandle(h);
+       // Open device
+       const char devpath[] = "\\\\.\\SMARTVSD";
+       HANDLE h = CreateFileA(devpath, GENERIC_READ|GENERIC_WRITE,
+               FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, 0);
+       if (h == INVALID_HANDLE_VALUE) {
+               if (con->reportataioctl > 1)
+                       pout(" %s: Open failed, Error=%ld\n", devpath, GetLastError());
+               return 0; // SMARTVSD.VXD missing or no ATA devices
+       }
 
-               if (con->reportataioctl) {
-                       pout(" %s: SMART_GET_VERSION (%ld bytes):\n"
-                            "  Vers = %d.%d, Caps = 0x%lx, DeviceMap = 0x%02x\n",
-                               devpath, num_out, vers.bVersion, vers.bRevision,
-                               vers.fCapabilities, vers.bIDEDeviceMap);
-                       if (vers_ex.wIdentifier == SMART_VENDOR_3WARE)
-                               pout("  Identifier = %04x(3WARE), ControllerId=%u, DeviceMapEx = 0x%08lx\n",
-                                       vers_ex.wIdentifier, vers_ex.wControllerId, vers_ex.dwDeviceMapEx);
-               }
+       // Get drive map
+       int devmap = smart_get_version(h);
+       CloseHandle(h);
+       if (devmap < 0)
+               return 0; // Should not happen
 
-               if (win9x) {
-                       // Check ATA device presence, remove ATAPI devices
-                       drives[0] = (vers.bIDEDeviceMap & 0xf) & ~((vers.bIDEDeviceMap >> 4) & 0xf);
-                       cnt = (drives[0]&1) + ((drives[0]>>1)&1) + ((drives[0]>>2)&1) + ((drives[0]>>3)&1);
-                       break;
-               }
+       // Check ATA device presence, remove ATAPI devices
+       drives[0] = (devmap & 0xf) & ~((devmap >> 4) & 0xf);
+       return (drives[0]&1) + ((drives[0]>>1)&1) + ((drives[0]>>2)&1) + ((drives[0]>>3)&1);
+}
+
+
+// Scan for ATA drives, fill bitmask of drives present, return #drives
+
+static int ata_scan(unsigned long * drives, int * rdriveno, unsigned long * rdrives)
+{
+       int cnt = 0;
+       for (int i = 0; i <= 9; i++) {
+               GETVERSIONINPARAMS_EX vers_ex;
+               if (get_phy_drive_type(i, &vers_ex) != CONTROLLER_ATA)
+                       continue;
 
+               // Interpret RAID drive map if present
                if (vers_ex.wIdentifier == SMART_VENDOR_3WARE) {
                        // Skip if more than 2 controllers or logical drive from this controller already seen
                        if (vers_ex.wControllerId >= 2 || rdriveno[vers_ex.wControllerId] >= 0)
@@ -1722,7 +2131,7 @@ static int ata_scan(unsigned long * drives, int * rdriveno, unsigned long * rdri
                        cnt += pcnt-1;
                }
 
-               // ATA drive exists and driver supports SMART ioctl
+               // Driver supports SMART_GET_VERSION or STORAGE_QUERY_PROPERTY returns ATA/SATA
                drives[0] |= (1L << i);
                cnt++;
        }
@@ -1757,8 +2166,9 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
        regs.bCylHighReg = SMART_CYL_HI; regs.bCylLowReg = SMART_CYL_LOW;
        int datasize = 0;
 
-       // Try all IOCTLS by default: SMART_*, ATA_, IDE_, SCSI_PASS_THROUGH
-       const char * valid_options = "saic";
+       // Try by default: SMART_*, ATA_, IDE_, SCSI_PASS_THROUGH,
+       // and SCSI_MINIPORT_* if requested by user
+       const char * valid_options = (ata_usr_options ? "saicm" : "saic");
 
        switch (command) {
          case CHECK_POWER_MODE:
@@ -1782,15 +2192,18 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
                regs.bFeaturesReg = ATA_SMART_READ_LOG_SECTOR;
                regs.bSectorNumberReg = select;
                regs.bSectorCountReg = 1;
-               valid_options = "saic3";
-               // Note: SMART_RCV_DRIVE_DATA supports this only on Win9x/ME
+               // SMART_RCV_DRIVE_DATA supports this only on Win9x/ME
+               // Try SCSI_MINIPORT also to skip buggy class driver
+               valid_options = (ata_usr_options || is_win9x() ? "saicm3" : "aicm3");
                datasize = 512;
                break;
          case WRITE_LOG:
                regs.bFeaturesReg = ATA_SMART_WRITE_LOG_SECTOR;
                regs.bSectorNumberReg = select;
                regs.bSectorCountReg = 1;
-               valid_options = "a"; // ATA_PASS_THROUGH only, others don't support DATA_OUT
+               // ATA_PASS_THROUGH, SCSI_MINIPORT, others don't support DATA_OUT
+               // but SCSI_MINIPORT_* only if requested by user
+               valid_options = (ata_usr_options ? "am" : "a");
                datasize = -512; // DATA_OUT!
                break;
          case IDENTIFY:
@@ -1816,7 +2229,8 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
                regs.bSectorNumberReg = 1;
                break;
          case STATUS_CHECK:
-               valid_options = "sai"; // Needs IDE register return
+               // Requires CL,CH register return
+               valid_options = (ata_usr_options ? "saim" : "sai");
          case STATUS:
                regs.bFeaturesReg = ATA_SMART_STATUS;
                break;
@@ -1831,8 +2245,9 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
          case IMMEDIATE_OFFLINE:
                regs.bFeaturesReg = ATA_SMART_IMMEDIATE_OFFLINE;
                regs.bSectorNumberReg = select;
-               valid_options = "saic3";
-               // Note: SMART_SEND_DRIVE_COMMAND supports ABORT_SELF_TEST only on Win9x/ME
+               // SMART_SEND_DRIVE_COMMAND supports ABORT_SELF_TEST only on Win9x/ME
+               valid_options = (ata_usr_options || select != 127/*ABORT*/ || is_win9x() ?
+                       "saicm3" : "aicm3");
                break;
          default:
                pout("Unrecognized command %d in win32_ata_command_interface()\n"
@@ -1843,8 +2258,10 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
 
        // Try all valid ioctls in the order specified in dev_ioctls;
        bool powered_up = false;
+       assert(ata_def_options);
+       const char * options = (ata_usr_options ? ata_usr_options : ata_def_options);
        for (int i = 0; ; i++) {
-               char opt = ata_cur_options[i];
+               char opt = options[i];
 
                if (!opt) {
                        if (command == CHECK_POWER_MODE && powered_up) {
@@ -1862,7 +2279,7 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
                        continue;
 
                errno = 0;
-               assert(datasize == 0 || datasize == 512 || (opt == 'a' && datasize == -512));
+               assert(datasize == 0 || datasize == 512 || (strchr("am", opt) && datasize == -512));
                int rc;
                switch (opt) {
                  default: assert(0);
@@ -1877,8 +2294,8 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
                                assert(port == -1);
                                if (smart_get_version(h_ata_ioctl) < 0) {
                                        if (!con->permissive) {
-                                               pout("ATA/SATA driver is possibly a SCSI class driver not supporting SMART.\n");
-                                               pout("If this is a SCSI disk, try \"scsi<adapter><id>\".\n");
+                                               pout("ATA/SATA driver is possibly a SCSI driver not supporting SMART.\n");
+                                               pout("If this is a SCSI disk, please try adding '-d scsi'.\n");
                                                ata_smartver_state[ata_driveno] = 2;
                                                rc = -1; errno = ENOSYS;
                                                break;
@@ -1889,6 +2306,9 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
                        }
                        rc = smart_ioctl(h_ata_ioctl, fd, &regs, data, datasize, port);
                        break;
+                 case 'm':
+                       rc = ata_via_scsi_miniport_smart_ioctl(h_ata_ioctl, &regs, data, datasize);
+                       break;
                  case 'a':
                        rc = ata_pass_through_ioctl(h_ata_ioctl, &regs, data, datasize);
                        break;
@@ -1967,7 +2387,7 @@ int ata_command_interface(int fd, smart_command_set command, int select, char *
 int ata_identify_is_cached(int fd)
 {
        // Not RAID and WinNT4/2000/XP => true, RAID or Win9x/ME => false
-       return (!(fd & 0xff00) && (GetVersion() & 0x80000000) == 0);
+       return (!(fd & 0xff00) && !is_win9x());
 }
 
 
@@ -1989,10 +2409,9 @@ static void pr_not_impl(const char * what, int * warned)
 }
 
 // Interface to ATA devices behind 3ware escalade RAID controller cards.  See os_linux.c
-int escalade_command_interface(int fd, int disknum, int escalade_type, smart_command_set command, int select, char *data)
+int escalade_command_interface(int /*fd*/, int disknum, int /*escalade_type*/, smart_command_set /*command*/, int /*select*/, char * /*data*/)
 {
        static int warned = 0;
-       ARGUSED(fd); ARGUSED(escalade_type); ARGUSED(command); ARGUSED(select); ARGUSED(data);
        if (!warned) {
                pout("Option '-d 3ware,%d' does not work on Windows.\n"
                     "Controller port can be specified in the device name: '/dev/hd%c,%d'.\n\n",
@@ -2004,20 +2423,18 @@ int escalade_command_interface(int fd, int disknum, int escalade_type, smart_com
 }
 
 // Interface to ATA devices behind Marvell chip-set based controllers.  See os_linux.c
-int marvell_command_interface(int fd, smart_command_set command, int select, char * data)
+int marvell_command_interface(int /*fd*/, smart_command_set /*command*/, int /*select*/, char * /*data*/)
 {
        static int warned = 0;
-       ARGUSED(fd); ARGUSED(command); ARGUSED(select); ARGUSED(data);
        pr_not_impl("Marvell chip-set command routine marvell_command_interface()", &warned);
        errno = ENOSYS;
        return -1;
 }
 
 // Interface to ATA devices behind HighPoint Raid controllers.  See os_linux.c
-int highpoint_command_interface(int fd, smart_command_set command, int select, char * data)
+int highpoint_command_interface(int /*fd*/, smart_command_set /*command*/, int /*select*/, char * /*data*/)
 {
        static int warned = 0;
-       ARGUSED(fd); ARGUSED(command); ARGUSED(select); ARGUSED(data);
        pr_not_impl("HighPoint raid controller command routine highpoint_command_interface()", &warned);
        errno = ENOSYS;
        return -1;
@@ -2346,10 +2763,9 @@ static int aspi_open(unsigned adapter, unsigned id)
 }
 
 
-static void aspi_close(int fd)
+static void aspi_close(int /*fd*/)
 {
        // No FreeLibrary(h_aspi_dll) to prevent problems with ASPI threads
-       ARGUSED(fd);
 }
 
 
@@ -2557,8 +2973,6 @@ static int do_aspi_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
 
 struct spt_dev_info {
        HANDLE h_spt_ioctl;
-       int   pd_num;           // physical drive number
-       int   tape_num;         // tape number ('\\.\TAPE<n>')
        int   sub_addr;         // addressing disks within a RAID, for example
 };
 
@@ -2567,7 +2981,7 @@ struct spt_dev_info {
 static struct spt_dev_info * spt_dev_arr[SPT_MAXDEV];
 
 
-static int spt_open(int pd_num, int tape_num, int sub_addr)
+static int spt_open(int pd_num, int ld_num, int tape_num, int sub_addr)
 {
        int k;
        struct spt_dev_info * sdip;
@@ -2593,18 +3007,18 @@ static int spt_open(int pd_num, int tape_num, int sub_addr)
                return -1;
        }
        spt_dev_arr[k] = sdip;
-       sdip->pd_num = pd_num;
-       sdip->tape_num = tape_num;
        sdip->sub_addr = sub_addr;
 
        b[sizeof(b) - 1] = '\0';
        if (pd_num >= 0)
                snprintf(b, sizeof(b) - 1, "\\\\.\\PhysicalDrive%d", pd_num);
+       else if (ld_num >= 0)
+               snprintf(b, sizeof(b) - 1, "\\\\.\\%c:", 'A' + ld_num);
        else if (tape_num >= 0)
                snprintf(b, sizeof(b) - 1, "\\\\.\\TAPE%d", tape_num);
        else {
                if (con->reportscsiioctl)
-                        pout("spt_open: bad parameters\n");
+                       pout("spt_open: bad parameters\n");
                errno = EINVAL;
                goto err_out;
        }
@@ -2620,7 +3034,7 @@ static int spt_open(int pd_num, int tape_num, int sub_addr)
        }
        sdip->h_spt_ioctl = h;
        return k + SPT_FDOFFSET;
-                               
+
 err_out:
        spt_dev_arr[k] = NULL;
        free(sdip);
@@ -2649,6 +3063,20 @@ static void spt_close(int fd)
 }
 
 
+static int spt_scan(unsigned long * drives)
+{
+       int cnt = 0;
+       for (int i = 0; i <= 9; i++) {
+               if (get_phy_drive_type(i) != CONTROLLER_SCSI)
+                       continue;
+               // STORAGE_QUERY_PROPERTY returned SCSI/SAS/...
+               drives[0] |= (1L << i);
+               cnt++;
+       }
+       return cnt;
+}
+
+
 #define IOCTL_SCSI_PASS_THROUGH_DIRECT  \
        CTL_CODE(IOCTL_SCSI_BASE, 0x0405, METHOD_BUFFERED, FILE_READ_ACCESS | FILE_WRITE_ACCESS)
 
@@ -2727,7 +3155,7 @@ static int do_spt_cmnd_io(int fd, struct scsi_cmnd_io * iop, int report)
 
        memset(&sb, 0, sizeof(sb));
        sb.spt.Length = sizeof(SCSI_PASS_THROUGH_DIRECT);
-        sb.spt.CdbLength = iop->cmnd_len;
+       sb.spt.CdbLength = iop->cmnd_len;
        memcpy(sb.spt.Cdb, iop->cmnd, iop->cmnd_len);
        sb.spt.SenseInfoLength = sizeof(sb.ucSenseBuf);
        sb.spt.SenseInfoOffset =
diff --git a/os_win32/.cvsignore b/os_win32/.cvsignore
new file mode 100644 (file)
index 0000000..9bd2229
--- /dev/null
@@ -0,0 +1,17 @@
+config.h
+config_vc6.h
+smartctl.d
+smartctl.r
+smartctl.exe
+smartctl_vc6.plg
+smartd.d
+smartd.r
+smartd.exe
+smartd_vc6.plg
+smartmontools_vc6.ncb
+smartmontools_vc6.opt
+syslogevt.d
+syslogevt.r
+syslogevt.exe
+syslogevt.h
+syslogevt_vc6.plg
index 870a2e667168a053b764d0b374e95e8625287976..17f3c044b81404680dd44b330498d689e6fcfaa7 100644 (file)
@@ -1,14 +1,14 @@
 ;
 ; installer.nsi - NSIS install script for smartmontools
 ;
-; Copyright (C) 2006 Christian Franke <smartmontools-support@lists.sourceforge.net>
+; Copyright (C) 2006-7 Christian Franke <smartmontools-support@lists.sourceforge.net>
 ;
 ; Project home page is: http://smartmontools.sourceforge.net
 ;
 ; Download and install NSIS from: http://nsis.sourceforge.net/Download
-; Process with makensis to create installer (tested with NSIS 2.17).
+; Process with makensis to create installer (tested with NSIS 2.29)
 ;
-; $Id: installer.nsi,v 1.2 2006/07/17 20:51:22 chrfranke Exp $
+; $Id: installer.nsi,v 1.3 2007/08/19 14:57:05 chrfranke Exp $
 ;
 
 
@@ -37,6 +37,7 @@ InstallColors /windows
 
 InstallDir "$PROGRAMFILES\smartmontools"
 InstallDirRegKey HKLM "Software\smartmontools" "Install_Dir"
+Var UBCDDIR
 
 LicenseData "${INPDIR}\doc\COPYING.txt"
 
@@ -45,7 +46,12 @@ LicenseData "${INPDIR}\doc\COPYING.txt"
 
 Page license
 Page components
-Page directory
+Page directory SkipProgPath "" ""
+PageEx directory
+  PageCallbacks SkipUBCDPath "" ""
+  DirText "Setup will install the UBCD4Win plugin in the following folder."
+  DirVar $UBCDDIR
+PageExEnd
 Page instfiles
 
 UninstPage uninstConfirm
@@ -53,14 +59,16 @@ UninstPage instfiles
 
 InstType "Full"
 InstType "Extract files only"
+InstType "Drive menu"
+InstType "UBCD4Win plugin"
 
 
 ;--------------------------------------------------------------------
 ; Sections
 
-SectionGroup "Program files"
+SectionGroup "!Program files"
 
-  Section "smartctl"
+  Section "smartctl" SMARTCTL_SECTION
 
     SectionIn 1 2
 
@@ -69,11 +77,19 @@ SectionGroup "Program files"
 
   SectionEnd
 
-  Section "smartd"
+  Section "smartd" SMARTD_SECTION
 
     SectionIn 1 2
 
     SetOutPath "$INSTDIR\bin"
+
+    ; Stop service ?
+    StrCpy $1 ""
+    IfFileExists "$INSTDIR\bin\smartd.exe" 0 nosrv
+      ReadRegStr $0 HKLM "System\CurrentControlSet\Services\smartd" "ImagePath"
+      StrCmp $0 "" nosrv
+        ExecWait "net stop smartd" $1
+  nosrv:
     File "${INPDIR}\bin\smartd.exe"
 
     IfFileExists "$INSTDIR\bin\smartd.conf" 0 +2
@@ -83,11 +99,16 @@ SectionGroup "Program files"
     IfFileExists "$WINDIR\system32\cmd.exe" 0 +2
       File /nonfatal "${INPDIR}\bin\syslogevt.exe"
 
+    ; Restart service ?
+    StrCmp $1 "0" 0 +3
+      MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2  "Restart smartd service ?" IDYES 0 IDNO +2
+        ExecWait "net start smartd"
+
   SectionEnd
 
 SectionGroupEnd
 
-Section "Documentation"
+Section "!Documentation" DOC_SECTION
 
   SectionIn 1 2
 
@@ -110,7 +131,7 @@ Section "Documentation"
 
 SectionEnd
 
-Section "Uninstaller"
+Section "Uninstaller" UNINST_SECTION
 
   SectionIn 1
   AddSize 35
@@ -122,14 +143,19 @@ Section "Uninstaller"
 
   ; Write uninstall keys and program
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "DisplayName" "smartmontools"
+  ;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "Publisher" "smartmontools"
   WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "UninstallString" '"$INSTDIR\uninst-smartmontools.exe"'
+  ;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "URLInfoAbout" "http://smartmontools.sourceforge.net/"
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "HelpLink"     "http://smartmontools.sourceforge.net/"
+  ;WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "URLUpdateInfo" "http://sourceforge.net/project/showfiles.php?group_id=64297"
+  WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "URLUpdateInfo" "http://smartmontools-win32.dyndns.org/"
   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "NoModify" 1
   WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools" "NoRepair" 1
   WriteUninstaller "uninst-smartmontools.exe"
 
 SectionEnd
 
-Section "Start Menu Shortcuts"
+Section "Start Menu Shortcuts" MENU_SECTION
 
   SectionIn 1
 
@@ -139,26 +165,27 @@ Section "Start Menu Shortcuts"
   IfFileExists "$INSTDIR\bin\smartctl.exe" 0 noctl
     SetOutPath "$INSTDIR\bin"
     DetailPrint "Create file: $INSTDIR\bin\smartctl-run.bat"
-    FileOpen $0 "$INSTDIR\bin\smartctl-run.bat" "w"
-    FileWrite $0 "@echo off$\r$\necho smartctl %1 %2 %3 %4 %5$\r$\nsmartctl %1 %2 %3 %4 %5$\r$\npause$\r$\n"
-    FileClose $0
+    Push "$INSTDIR\bin\smartctl-run.bat"
+    Call CreateSmartctlBat
+    IfFileExists "$WINDIR\system32\cmd.exe" 0 +2
+      CreateShortCut "$SMPROGRAMS\smartmontools\smartctl (CMD).lnk" "cmd.exe" "/k smartctl-run.bat"
     CreateDirectory "$SMPROGRAMS\smartmontools\smartctl Examples"
     FileOpen $0 "$SMPROGRAMS\smartmontools\smartctl Examples\!Read this first!.txt" "w"
-    FileWrite $0 "All the example commands in this directory$\r$\napply to the first IDE/ATA/SATA drive (hda).$\r$\n"
+    FileWrite $0 "All the example commands in this directory$\r$\napply to the first drive (sda).$\r$\n"
     FileClose $0
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\All info (-a).lnk"                    "$INSTDIR\bin\smartctl-run.bat" "-a hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Identify drive (-i).lnk"              "$INSTDIR\bin\smartctl-run.bat" "-i hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART attributes (-A).lnk"            "$INSTDIR\bin\smartctl-run.bat" "-A hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART capabilities (-c).lnk"          "$INSTDIR\bin\smartctl-run.bat" "-c hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART health status (-H).lnk"         "$INSTDIR\bin\smartctl-run.bat" "-H hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART error log (-l error).lnk"       "$INSTDIR\bin\smartctl-run.bat" "-l error hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART selftest log (-l selftest).lnk" "$INSTDIR\bin\smartctl-run.bat" "-l selftest hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start long selftest (-t long).lnk"    "$INSTDIR\bin\smartctl-run.bat" "-t long hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start offline test (-t offline).lnk"  "$INSTDIR\bin\smartctl-run.bat" "-t offline hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start short selftest (-t short).lnk"  "$INSTDIR\bin\smartctl-run.bat" "-t short hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Stop(Abort) selftest (-X).lnk"        "$INSTDIR\bin\smartctl-run.bat" "-X hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART off (-s off).lnk"          "$INSTDIR\bin\smartctl-run.bat" "-s off hda"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART on (-s on).lnk"            "$INSTDIR\bin\smartctl-run.bat" "-s on hda"  
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\All info (-a).lnk"                    "$INSTDIR\bin\smartctl-run.bat" "-a sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Identify drive (-i).lnk"              "$INSTDIR\bin\smartctl-run.bat" "-i sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART attributes (-A).lnk"            "$INSTDIR\bin\smartctl-run.bat" "-A sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART capabilities (-c).lnk"          "$INSTDIR\bin\smartctl-run.bat" "-c sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART health status (-H).lnk"         "$INSTDIR\bin\smartctl-run.bat" "-H sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART error log (-l error).lnk"       "$INSTDIR\bin\smartctl-run.bat" "-l error sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\SMART selftest log (-l selftest).lnk" "$INSTDIR\bin\smartctl-run.bat" "-l selftest sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start long selftest (-t long).lnk"    "$INSTDIR\bin\smartctl-run.bat" "-t long sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start offline test (-t offline).lnk"  "$INSTDIR\bin\smartctl-run.bat" "-t offline sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Start short selftest (-t short).lnk"  "$INSTDIR\bin\smartctl-run.bat" "-t short sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Stop(Abort) selftest (-X).lnk"        "$INSTDIR\bin\smartctl-run.bat" "-X sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART off (-s off).lnk"          "$INSTDIR\bin\smartctl-run.bat" "-s off sda"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartctl Examples\Turn SMART on (-s on).lnk"            "$INSTDIR\bin\smartctl-run.bat" "-s on sda"  
   noctl:
 
   ; smartd
@@ -169,9 +196,9 @@ Section "Start Menu Shortcuts"
     FileWrite $0 "@echo off$\r$\necho smartd %1 %2 %3 %4 %5$\r$\nsmartd %1 %2 %3 %4 %5$\r$\npause$\r$\n"
     FileClose $0
     CreateDirectory "$SMPROGRAMS\smartmontools\smartd Examples"
-    CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, log to smartd.log.lnk" "$INSTDIR\bin\smartd-run.bat" "-l local0"
+    CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, smartd.log.lnk" "$INSTDIR\bin\smartd-run.bat" "-l local0"
     IfFileExists "$WINDIR\system32\cmd.exe" 0 +2
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, log to eventlog.lnk" "$INSTDIR\bin\smartd-run.bat" ""
+      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon start, eventlog.lnk" "$INSTDIR\bin\smartd-run.bat" ""
     CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Daemon stop.lnk" "$INSTDIR\bin\smartd-run.bat" "stop"
     CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Do all tests once (-q onecheck).lnk" "$INSTDIR\bin\smartd-run.bat" "-q onecheck"
     CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Debug mode (-d).lnk" "$INSTDIR\bin\smartd-run.bat" "-d"
@@ -182,8 +209,9 @@ Section "Start Menu Shortcuts"
 
     ; smartd service (not on 9x/ME)
     IfFileExists "$WINDIR\system32\cmd.exe" 0 nosvc
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, log to eventlog.lnk" "$INSTDIR\bin\smartd-run.bat" "install"
-      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, log to smartd.log.lnk" "$INSTDIR\bin\smartd-run.bat" "install -l local0"
+      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, eventlog, 30min.lnk" "$INSTDIR\bin\smartd-run.bat" "install"
+      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, smartd.log, 10min.lnk" "$INSTDIR\bin\smartd-run.bat" "install -l local0 -i 600"
+      CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service install, smartd.log, 30min.lnk" "$INSTDIR\bin\smartd-run.bat" "install -l local0"
       CreateShortCut "$SMPROGRAMS\smartmontools\smartd Examples\Service remove.lnk" "$INSTDIR\bin\smartd-run.bat" "remove"
       DetailPrint "Create file: $INSTDIR\bin\net-run.bat"
       FileOpen $0 "$INSTDIR\bin\net-run.bat" "w"
@@ -214,6 +242,7 @@ Section "Start Menu Shortcuts"
     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\README.lnk"    "$INSTDIR\doc\README.txt"
     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\TODO.lnk"      "$INSTDIR\doc\TODO.txt"
     CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\WARNINGS.lnk"  "$INSTDIR\doc\WARNINGS.txt"
+    CreateShortCut "$SMPROGRAMS\smartmontools\Documentation\Windows version download page.lnk" "http://smartmontools-win32.dyndns.org/smartmontools/"
   nodoc:
 
   ; Homepage
@@ -225,7 +254,7 @@ Section "Start Menu Shortcuts"
 
 SectionEnd
 
-Section "Add install dir to PATH" PATH_IDX
+Section "Add install dir to PATH" PATH_SECTION
 
   SectionIn 1
 
@@ -235,14 +264,105 @@ Section "Add install dir to PATH" PATH_IDX
  
 SectionEnd
 
+SectionGroup "Add smartctl to drive menu"
+
+!macro DriveMenuRemove
+  DetailPrint "Remove drive menu entries"
+  DeleteRegKey HKCR "Drive\shell\smartctl0"
+  DeleteRegKey HKCR "Drive\shell\smartctl1"
+  DeleteRegKey HKCR "Drive\shell\smartctl2"
+  DeleteRegKey HKCR "Drive\shell\smartctl3"
+  DeleteRegKey HKCR "Drive\shell\smartctl4"
+  DeleteRegKey HKCR "Drive\shell\smartctl5"
+!macroend
+
+  Section "Remove existing entries first"
+    SectionIn 3
+    !insertmacro DriveMenuRemove
+  SectionEnd
+
+!macro DriveSection id name args
+  Section 'smartctl ${args} ...' DRIVE_${id}_SECTION
+    SectionIn 3
+    DetailPrint 'Add drive menu entry "${name}": smartctl ${args} ...'
+    WriteRegStr HKCR "Drive\shell\smartctl${id}" "" "${name}"
+    WriteRegStr HKCR "Drive\shell\smartctl${id}\command" "" '"$INSTDIR\bin\smartctl-run.bat" ${args} %L'
+  SectionEnd
+!macroend
+
+  !insertmacro DriveSection 0 "SMART all info"       "-a"
+  !insertmacro DriveSection 1 "SMART status"         "-Hc"
+  !insertmacro DriveSection 2 "SMART attributes"     "-A"
+  !insertmacro DriveSection 3 "SMART short selftest" "-t short"
+  !insertmacro DriveSection 4 "SMART long selftest"  "-t long"
+  !insertmacro DriveSection 5 "SMART continue selective selftest"  '-t "selective,cont"'
+
+SectionGroupEnd
+
+Section "UBCD4Win Plugin" UBCD_SECTION
+
+  SectionIn 4
+
+  SetOutPath "$UBCDDIR"
+  DetailPrint "Create file: smartmontools.inf"
+  FileOpen $0 "$UBCDDIR\smartmontools.inf" "w"
+  FileWrite $0 '; smartmontools.inf$\r$\n; PE Builder v3 plug-in INF file$\r$\n'
+  FileWrite $0 '; Created by smartmontools installer$\r$\n'
+  FileWrite $0 '; http://smartmontools.sourceforge.net/$\r$\n$\r$\n'
+  FileWrite $0 '[Version]$\r$\nSignature= "$$Windows NT$$"$\r$\n$\r$\n'
+  FileWrite $0 '[PEBuilder]$\r$\nName="Disk -Diagnostic: smartmontools"$\r$\n'
+  FileWrite $0 'Enable=1$\r$\nHelp="files\smartctl.8.html"$\r$\n$\r$\n'
+  FileWrite $0 '[WinntDirectories]$\r$\na=Programs\smartmontools,2$\r$\n$\r$\n'
+  FileWrite $0 '[SourceDisksFolders]$\r$\nfiles=a,,1$\r$\n$\r$\n'
+  FileWrite $0 '[Append]$\r$\nnu2menu.xml, smartmontools_nu2menu.xml$\r$\n'
+  FileClose $0
+
+  DetailPrint "Create file: smartmontools_nu2menu.xml"
+  FileOpen $0 "$UBCDDIR\smartmontools_nu2menu.xml" "w"
+  FileWrite $0 '<!-- Nu2Menu entry for smartmontools -->$\r$\n<NU2MENU>$\r$\n'
+  FileWrite $0 '$\t<MENU ID="Programs">$\r$\n$\t$\t<MITEM TYPE="POPUP" MENUID="Disk Tools">'
+  FileWrite $0 'Disk Tools</MITEM>$\r$\n$\t</MENU>$\r$\n$\t<MENU ID="Disk Tools">$\r$\n'
+  FileWrite $0 '$\t$\t<MITEM TYPE="POPUP" MENUID="Diagnostic">Diagnostic</MITEM>$\r$\n$\t</MENU>'
+  FileWrite $0 '$\r$\n$\t<MENU ID="Diagnostic">$\r$\n$\t$\t<MITEM TYPE="ITEM" DISABLED="'
+  FileWrite $0 '@Not(@FileExists(@GetProgramDrive()\Programs\smartmontools\smartctl.exe))" '
+  FileWrite $0 'CMD="RUN" FUNC="cmd.exe /k cd /d @GetProgramDrive()\Programs\smartmontools&'
+  FileWrite $0 'set PATH=@GetProgramDrive()\Programs\smartmontools;%PATH%&smartctl-run.bat  ">'
+  FileWrite $0 'smartctl</MITEM>$\r$\n$\t</MENU>$\r$\n</NU2MENU>$\r$\n'
+  FileClose $0
+  
+  SetOutPath "$UBCDDIR\files"
+  DetailPrint "Create file: smartctl-run.bat"
+  Push "$UBCDDIR\files\smartctl-run.bat"
+  Call CreateSmartctlBat
+  File "${INPDIR}\bin\smartctl.exe"
+  File "${INPDIR}\bin\smartd.exe"
+  File "${INPDIR}\doc\smartctl.8.html"
+  File "${INPDIR}\doc\smartctl.8.txt"
+  File "${INPDIR}\doc\smartd.8.html"
+  File "${INPDIR}\doc\smartd.8.txt"
+  File "${INPDIR}\doc\smartd.conf"
+
+SectionEnd
+
+
 ;--------------------------------------------------------------------
 
 Section "Uninstall"
   
-  ; Remove registry keys
+  ; Stop & remove service
+  IfFileExists "$INSTDIR\bin\smartd.exe" 0 nosrv
+    ReadRegStr $0 HKLM "System\CurrentControlSet\Services\smartd" "ImagePath"
+    StrCmp $0 "" nosrv
+      ExecWait "net stop smartd"
+      MessageBox MB_YESNO|MB_ICONQUESTION|MB_DEFBUTTON2  "Remove smartd service ?" IDYES 0 IDNO nosrv
+        ExecWait "$INSTDIR\bin\smartd.exe remove"
+  nosrv:
+
+  ; Remove installer registry keys
   DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\smartmontools"
   DeleteRegKey HKLM "Software\smartmontools"
 
+  ; Remove conf and log file
   IfFileExists "$INSTDIR\bin\smartd.conf" 0 noconf
     ; Assume unchanged if timestamp is equal to sample file
     GetFileTime "$INSTDIR\bin\smartd.conf" $0 $1
@@ -288,8 +408,8 @@ Section "Uninstall"
 
   ; Remove folders
   RMDir  "$SMPROGRAMS\smartmontools\Documentation"
-  RMDir  "$SMPROGRAMS\smartmontools\smartctl Examples\"
-  RMDir  "$SMPROGRAMS\smartmontools\smartd Examples\"
+  RMDir  "$SMPROGRAMS\smartmontools\smartctl Examples"
+  RMDir  "$SMPROGRAMS\smartmontools\smartd Examples"
   RMDir  "$SMPROGRAMS\smartmontools"
   RMDir  "$INSTDIR\bin"
   RMDir  "$INSTDIR\doc"
@@ -300,28 +420,98 @@ Section "Uninstall"
     Push "$INSTDIR\bin"
     Call un.RemoveFromPath
 
-  ; Check for still existing files
+  ; Remove drive menu registry entries
+  !insertmacro DriveMenuRemove
+
+  ; Check for still existing entries
   IfFileExists "$INSTDIR\bin\smartd.exe" 0 +3
     MessageBox MB_OK|MB_ICONEXCLAMATION "$INSTDIR\bin\smartd.exe could not be removed.$\nsmartd is possibly still running."
     Goto +3
   IfFileExists "$INSTDIR" 0 +2
     MessageBox MB_OK "Note: $INSTDIR could not be removed."
 
+  IfFileExists "$SMPROGRAMS\smartmontools" 0 +2
+    MessageBox MB_OK "Note: $SMPROGRAMS\smartmontools could not be removed."
+
 SectionEnd
 
 ;--------------------------------------------------------------------
+; Functions
 
 Function .onInit
 
+  ; Get UBCD4Win install location
+  ReadRegStr $0 HKLM "Software\UBCD4Win" "InstallPath"
+  StrCmp $0 "" 0 +2
+    StrCpy $0 "C:\UBCD4Win"
+  StrCpy $UBCDDIR "$0\plugin\Disk\Diagnostic\smartmontools"
+
   ; Hide "Add install dir to PATH" on 9x/ME
   IfFileExists "$WINDIR\system32\cmd.exe" +2 0
-    SectionSetText ${PATH_IDX} ""
+    SectionSetText ${PATH_SECTION} ""
 
 FunctionEnd
 
+; Directory page callbacks
+
+!macro CheckSection section
+  SectionGetFlags ${section} $0
+  IntOp $0 $0 & 1
+  IntCmp $0 1 done
+!macroend
+
+Function SkipProgPath
+  !insertmacro CheckSection ${SMARTCTL_SECTION}
+  !insertmacro CheckSection ${SMARTD_SECTION}
+  !insertmacro CheckSection ${DOC_SECTION}
+  !insertmacro CheckSection ${MENU_SECTION}
+  !insertmacro CheckSection ${PATH_SECTION}
+  !insertmacro CheckSection ${DRIVE_0_SECTION}
+  !insertmacro CheckSection ${DRIVE_1_SECTION}
+  !insertmacro CheckSection ${DRIVE_2_SECTION}
+  !insertmacro CheckSection ${DRIVE_3_SECTION}
+  !insertmacro CheckSection ${DRIVE_4_SECTION}
+  !insertmacro CheckSection ${DRIVE_5_SECTION}
+  Abort
+done:
+FunctionEnd
+
+Function SkipUBCDPath
+  !insertmacro CheckSection ${UBCD_SECTION}
+  Abort
+done:
+FunctionEnd
+
+
+; Create smartctl-run.bat
+
+Function CreateSmartctlBat
+  Exch $0
+  FileOpen $0 $0 "w"
+  FileWrite $0 '@echo off$\r$\nif not "%1" == "" goto run$\r$\n'
+  FileWrite $0 'echo Examples (for first drive):$\r$\n'
+  FileWrite $0 'echo smartctl -i sda            Show identify information$\r$\n'
+  FileWrite $0 'echo smartctl -H sda            Show SMART health status$\r$\n'
+  FileWrite $0 'echo smartctl -c sda            Show SMART capabilities$\r$\n'
+  FileWrite $0 'echo smartctl -A sda            Show SMART attributes$\r$\n'
+  FileWrite $0 'echo smartctl -l error sda      Show error log$\r$\n'
+  FileWrite $0 'echo smartctl -l selftest sda   Show self-test log$\r$\n'
+  FileWrite $0 'echo smartctl -a sda            Show all of the above$\r$\n'
+  FileWrite $0 'echo smartctl -t short sda      Start short self test$\r$\n'
+  FileWrite $0 'echo smartctl -t long sda       Start long self test$\r$\n'
+  FileWrite $0 'echo Use "sdb", "sdc", ... for second, third, ... drive.$\r$\n'
+  FileWrite $0 'echo See man page (smartctl.8.*) for further info.$\r$\n'
+  FileWrite $0 'goto end$\r$\n:run$\r$\n'
+  FileWrite $0 'echo smartctl %1 %2 %3 %4 %5$\r$\n'
+  FileWrite $0 'smartctl %1 %2 %3 %4 %5$\r$\n'
+  FileWrite $0 'pause$\r$\n:end$\r$\n'
+  FileClose $0
+  Pop $0
+FunctionEnd
+
 
 ;--------------------------------------------------------------------
-; Utility functions
+; Path functions
 ;
 ; Based on example from:
 ; http://nsis.sourceforge.net/Path_Manipulation
@@ -349,19 +539,19 @@ Function AddToPath
   Push $1
   Push $2
   Push $3
+
   ReadRegStr $1 ${Environ} "PATH"
   Push "$1;"
   Push "$0;"
   Call StrStr
   Pop $2
-  StrCmp $2 "" "" done
+  StrCmp $2 "" 0 done
   Push "$1;"
   Push "$0\;"
   Call StrStr
   Pop $2
-  StrCmp $2 "" "" done
+  StrCmp $2 "" 0 done
+
   DetailPrint "Add to PATH: $0"
   StrCpy $2 $1 1 -1
   StrCmp $2 ";" 0 +2
@@ -370,7 +560,7 @@ Function AddToPath
     StrCpy $0 "$1;$0"
   WriteRegExpandStr ${Environ} "PATH" $0
   SendMessage ${HWND_BROADCAST} ${WM_WININICHANGE} 0 "STR:Environment" /TIMEOUT=5000
+
 done:
   Pop $3
   Pop $2
@@ -384,7 +574,7 @@ FunctionEnd
 ; Usage:
 ;   Push "dir"
 ;   Call RemoveFromPath
+
 Function un.RemoveFromPath
   Exch $0
   Push $1
@@ -393,7 +583,7 @@ Function un.RemoveFromPath
   Push $4
   Push $5
   Push $6
+
   ReadRegStr $1 ${Environ} "PATH"
   StrCpy $5 $1 1 -1
   StrCmp $5 ";" +2
@@ -434,7 +624,7 @@ FunctionEnd
 ;   Push "some"
 ;   Call StrStr
 ;   Pop $0 ; "some string"
+
 !macro StrStr un
 Function ${un}StrStr
   Exch $R1 ; $R1=substring, stack=[old$R1,string,...]
diff --git a/os_win32/smartctl_vc6.dsp b/os_win32/smartctl_vc6.dsp
new file mode 100644 (file)
index 0000000..516623b
--- /dev/null
@@ -0,0 +1,244 @@
+# Microsoft Developer Studio Project File - Name="smartctl_vc6" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** NICHT BEARBEITEN **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=smartctl_vc6 - Win32 Debug\r
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE\r
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "smartctl_vc6.mak".\r
+!MESSAGE \r
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben\r
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "smartctl_vc6.mak" CFG="smartctl_vc6 - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Für die Konfiguration stehen zur Auswahl:\r
+!MESSAGE \r
+!MESSAGE "smartctl_vc6 - Win32 Release" (basierend auf  "Win32 (x86) Console Application")\r
+!MESSAGE "smartctl_vc6 - Win32 Debug" (basierend auf  "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "smartctl_vc6 - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "smartctl.r"\r
+# PROP Intermediate_Dir "smartctl.r"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O1 /I "." /I ".." /I "..\posix" /D "NDEBUG" /D "HAVE_CONFIG_H" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0x407 /d "NDEBUG"\r
+# ADD RSC /l 0x407 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"smartctl.exe"\r
+\r
+!ELSEIF  "$(CFG)" == "smartctl_vc6 - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "smartctl.d"\r
+# PROP Intermediate_Dir "smartctl.d"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\posix" /D "_DEBUG" /D "HAVE_CONFIG_H" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x407 /d "_DEBUG"\r
+# ADD RSC /l 0x407 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "smartctl_vc6 - Win32 Release"\r
+# Name "smartctl_vc6 - Win32 Debug"\r
+# Begin Group "posix"\r
+\r
+# PROP Default_Filter ""\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\getopt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\getopt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\getopt1.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regcomp.c\r
+# PROP Exclude_From_Build 1\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regex.c\r
+# ADD CPP /w /W0\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regex.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regex_internal.c\r
+# PROP Exclude_From_Build 1\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regex_internal.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regexec.c\r
+# PROP Exclude_From_Build 1\r
+# End Source File\r
+# End Group\r
+# Begin Source File\r
+\r
+SOURCE=..\atacmdnames.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\atacmdnames.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\atacmds.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\atacmds.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\ataprint.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\ataprint.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\config_vc6.h\r
+\r
+!IF  "$(CFG)" == "smartctl_vc6 - Win32 Release"\r
+\r
+# Begin Custom Build - Copy $(InputPath) config.h\r
+InputPath=.\config_vc6.h\r
+\r
+"config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       copy $(InputPath) config.h\r
+\r
+# End Custom Build\r
+\r
+!ELSEIF  "$(CFG)" == "smartctl_vc6 - Win32 Debug"\r
+\r
+# Begin Custom Build - Copy $(InputPath) config.h\r
+InputPath=.\config_vc6.h\r
+\r
+"config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       copy $(InputPath) config.h\r
+\r
+# End Custom Build\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\extern.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\int64.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\knowndrives.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\knowndrives.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\os_win32.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsiata.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsiata.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsicmds.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsicmds.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsiprint.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsiprint.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\smartctl.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\smartctl.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\syslog.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\utility.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\utility.h\r
+# End Source File\r
+# End Target\r
+# End Project\r
diff --git a/os_win32/smartd_vc6.dsp b/os_win32/smartd_vc6.dsp
new file mode 100644 (file)
index 0000000..6610ae6
--- /dev/null
@@ -0,0 +1,268 @@
+# Microsoft Developer Studio Project File - Name="smartd_vc6" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** NICHT BEARBEITEN **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=smartd_vc6 - Win32 Debug\r
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE\r
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "smartd_vc6.mak".\r
+!MESSAGE \r
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben\r
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "smartd_vc6.mak" CFG="smartd_vc6 - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Für die Konfiguration stehen zur Auswahl:\r
+!MESSAGE \r
+!MESSAGE "smartd_vc6 - Win32 Release" (basierend auf  "Win32 (x86) Console Application")\r
+!MESSAGE "smartd_vc6 - Win32 Debug" (basierend auf  "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "smartd_vc6 - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "smartd.r"\r
+# PROP Intermediate_Dir "smartd.r"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /W3 /GX /O1 /I "." /I ".." /I "..\posix" /D "NDEBUG" /D "HAVE_CONFIG_H" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0x407 /d "NDEBUG"\r
+# ADD RSC /l 0x407 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"smartd.exe"\r
+\r
+!ELSEIF  "$(CFG)" == "smartd_vc6 - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "smartd.d"\r
+# PROP Intermediate_Dir "smartd.d"\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "." /I ".." /I "..\posix" /D "_DEBUG" /D "HAVE_CONFIG_H" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x407 /d "_DEBUG"\r
+# ADD RSC /l 0x407 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "smartd_vc6 - Win32 Release"\r
+# Name "smartd_vc6 - Win32 Debug"\r
+# Begin Group "posix"\r
+\r
+# PROP Default_Filter ""\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\getopt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\getopt.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\getopt1.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regcomp.c\r
+# PROP Exclude_From_Build 1\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regex.c\r
+# ADD CPP /w /W0\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regex.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regex_internal.c\r
+# PROP Exclude_From_Build 1\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regex_internal.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\posix\regexec.c\r
+# PROP Exclude_From_Build 1\r
+# End Source File\r
+# End Group\r
+# Begin Source File\r
+\r
+SOURCE=..\atacmdnames.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\atacmdnames.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\atacmds.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\atacmds.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\ataprint.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\ataprint.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\config_vc6.h\r
+\r
+!IF  "$(CFG)" == "smartd_vc6 - Win32 Release"\r
+\r
+# Begin Custom Build - Copy $(InputPath) config.h\r
+InputPath=.\config_vc6.h\r
+\r
+"config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       copy $(InputPath) config.h\r
+\r
+# End Custom Build\r
+\r
+!ELSEIF  "$(CFG)" == "smartd_vc6 - Win32 Debug"\r
+\r
+# Begin Custom Build - Copy $(InputPath) config.h\r
+InputPath=.\config_vc6.h\r
+\r
+"config.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+       copy $(InputPath) config.h\r
+\r
+# End Custom Build\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\daemon_win32.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\daemon_win32.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\extern.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\hostname_win32.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\hostname_win32.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\int64.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\knowndrives.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\knowndrives.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\os_win32.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsiata.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsiata.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsicmds.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsicmds.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsiprint.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\scsiprint.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\smartctl.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\smartd.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\smartd.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\syslog.h\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\syslog_win32.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\utility.cpp\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=..\utility.h\r
+# End Source File\r
+# End Target\r
+# End Project\r
diff --git a/os_win32/smartmontools_vc6.dsw b/os_win32/smartmontools_vc6.dsw
new file mode 100644 (file)
index 0000000..76e451e
--- /dev/null
@@ -0,0 +1,53 @@
+Microsoft Developer Studio Workspace File, Format Version 6.00\r
+# WARNUNG: DIESE ARBEITSBEREICHSDATEI DARF NICHT BEARBEITET ODER GELÖSCHT WERDEN!\r
+\r
+###############################################################################\r
+\r
+Project: "smartctl_vc6"=.\smartctl_vc6.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "smartd_vc6"=.\smartd_vc6.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Project: "syslogevt_vc6"=.\syslogevt_vc6.dsp - Package Owner=<4>\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<4>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
+Global:\r
+\r
+Package=<5>\r
+{{{\r
+}}}\r
+\r
+Package=<3>\r
+{{{\r
+}}}\r
+\r
+###############################################################################\r
+\r
diff --git a/os_win32/syslogevt.c b/os_win32/syslogevt.c
new file mode 100644 (file)
index 0000000..016bf98
--- /dev/null
@@ -0,0 +1,156 @@
+/*
+ * os_win32/syslogevt.c
+ *
+ * Home page of code is: http://smartmontools.sourceforge.net
+ *
+ * Copyright (C) 2004-6 Christian Franke <smartmontools-support@lists.sourceforge.net>
+ *
+ * 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 Software Foundation; either version 2, or (at your option)
+ * any later version.
+ *
+ * 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.
+ *
+ */
+
+static char rcsid[] = "$Id: syslogevt.c,v 1.4 2006/04/12 14:54:29 ballen4705 Exp $";
+
+#include <stdio.h>
+#include <string.h>
+#include <process.h>
+
+#define WIN32_LEAN_AND_MEAN
+#include <windows.h>
+
+#ifdef _DEBUG
+#include "syslogevt.h"
+#endif
+
+
+static int usage()
+{
+       puts(
+               "syslogevt $Revision: 1.4 $ Copyright (C) 2004-6 Christian Franke\n"
+               "Home page is http://smartmontools.sourceforge.net/\n"
+               "\n"
+               "Usage: syslogevt [-ru] name [ident ...]\n"
+               "\n"
+               "Creates registry files \"name-r.reg\" and \"name-u.reg\" to (un)register\n"
+               "this program as an event message file for message source(s) \"ident\".\n"
+               "If \"ident\" is ommited, \"name\" is used. Options:\n"
+               "\n"
+               "    -r    run \"regedit name-r.reg\" after creating files\n"
+               "    -u    run \"regedit name-u.reg\" after creating files\n"
+               "\n"
+               "Examples:\n"
+               "\n"
+               "syslogevt smartd                     (Create smartd-r.reg and smartd-u.reg)\n"
+               "regedit smartd-r.reg           (Register syslogevt.exe for smartd messages)\n"
+               "\n"
+               "syslogevt -r smartd                             (Same as above in one step)\n"
+               "\n"
+               "regedit smartd-u.reg                                (Undo the registration)\n"
+               "\n"
+               "CAUTION: A registry entry of an existing event source with the same \"ident\"\n"
+               "         will be overwritten by regedit without notice."
+       );
+       return 1;
+}
+
+main(int argc, char ** argv)
+{
+       int regedit, a1, ai;
+       char name1[30+1], name2[30+1], mypath[MAX_PATH+1];
+       const char * ident;
+       FILE * f1, * f2;
+
+#ifdef _DEBUG
+       if (!(MSG_SYSLOG == 0 && MSG_SYSLOG_01 == 1 && MSG_SYSLOG_10 == 10)) {
+               puts("Internal error: MSG_SYSLOG_n != n"); return 1;
+       }
+#endif
+
+       if (argc < 2)
+               return usage();
+
+       a1 = 1;
+       regedit = 0;
+       if (!strcmp(argv[a1], "-r")) {
+               regedit = 1; a1++;
+       }
+       else if (!strcmp(argv[a1], "-u")) {
+               regedit = -1; a1++;
+       }
+
+       for (ai = a1; ai < argc; ai++) {
+               ident = argv[ai];
+               if (!(ident[0] && strlen(ident) < sizeof(name1)-10
+                         && strcspn(ident, "-.:/\\") == strlen(ident) )) {
+                       return usage();
+               }
+       }
+
+       if (!GetModuleFileName(NULL, mypath, sizeof(mypath)-1)) {
+               fputs("GetModuleFileName failed\n", stderr);
+               return 1;
+       }
+
+       ident = argv[a1];
+       strcpy(name1, ident); strcat(name1, "-r.reg");
+       strcpy(name2, ident); strcat(name2, "-u.reg");
+
+       if (!(f1 = fopen(name1, "w"))) {
+               perror(name1); return 1;
+       }
+       if (!(f2 = fopen(name2, "w"))) {
+               perror(name2); unlink(name1); return 1;
+       }
+
+       fputs("REGEDIT4\n\n", f1);
+       fputs("REGEDIT4\n\n", f2);
+
+       for (ai = (argc > a1+1 ? a1+1 : a1); ai < argc; ai++) {
+               int i;
+               ident = argv[ai];
+               fputs("[HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\", f1);
+               fputs(ident, f1); fputs("]\n\"EventMessageFile\"=\"", f1);
+               for (i = 0; mypath[i]; i++) {
+                       if (mypath[i] == '\\')
+                               fputc('\\', f1);
+                       fputc(mypath[i], f1);
+               }
+               fputs("\"\n\"TypesSupported\"=dword:00000007\n\n", f1);
+
+               fputs("[-HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Eventlog\\Application\\", f2);
+               fputs(ident, f2); fputs("]\n\n", f2);
+       }
+
+       fclose(f1);
+       fclose(f2);
+
+       if (GetVersion() & 0x80000000) {
+               puts("Warning: Event log not supported on Win9x/ME\n");
+               if (regedit)
+                       return 1;
+       }
+
+       if (regedit) {
+               if (spawnlp(P_WAIT, "regedit", "regedit", (regedit > 0 ? name1 : name2), (const char *)0) == -1) {
+                       fputs("regedit: cannot execute\n", stderr);
+                       return 1;
+               }
+       }
+       else {
+               fputs("Files generated. Use\n\n    regedit ", stdout);
+               puts(name1);
+               fputs("\nto register event message file, and\n\n    regedit ", stdout);
+               puts(name2);
+               fputs("\nto remove registration later.\n\n"
+                         "Do not remove this program when registered.\n", stdout);
+       }
+
+       return 0;
+}
diff --git a/os_win32/syslogevt.mc b/os_win32/syslogevt.mc
new file mode 100644 (file)
index 0000000..41675a1
--- /dev/null
@@ -0,0 +1,161 @@
+;/*
+; * os_win32/syslogevt.mc
+; *
+; * Home page of code is: http://smartmontools.sourceforge.net
+; *
+; * Copyright (C) 2004-6 Christian Franke <smartmontools-support@lists.sourceforge.net>
+; *
+; * 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 Software Foundation; either version 2, or (at your option)
+; * any later version.
+; *
+; * 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.
+; *
+; */
+;
+;// $Id: syslogevt.mc,v 1.4 2006/04/12 14:54:29 ballen4705 Exp $
+;
+;// Use message compiler "mc" to generate
+;//   syslogevt.rc, syslogevt.h, msg00001.bin
+;// from this file.
+;// MSG_SYSLOG in syslogmsg.h must be zero
+;// MSG_SYSLOG_nn must be == nn
+;
+;
+
+MessageId=0x0
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG
+Language=English
+%1
+.
+;// 1-10 Line SYSLOG Messages
+;// %1=Ident, %2=PID, %3=Severity, %[4-13]=Line 1-10
+MessageId=0x1
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_01
+Language=English
+%1[%2]:%3: %4
+.
+MessageId=0x2
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_02
+Language=English
+%1[%2]:%3%n
+%4%n
+%5
+.
+MessageId=0x3
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_03
+Language=English
+%1[%2]:%3%n
+%4%n
+%5%n
+%6
+.
+MessageId=0x4
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_04
+Language=English
+%1[%2]:%3%n
+%4%n
+%5%n
+%6%n
+%7
+.
+MessageId=0x5
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_05
+Language=English
+%1[%2]:%3%n
+%4%n
+%5%n
+%6%n
+%7%n
+%8
+.
+MessageId=0x6
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_06
+Language=English
+%1[%2]:%3%n
+%4%n
+%5%n
+%6%n
+%7%n
+%8%n
+%9
+.
+MessageId=0x7
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_07
+Language=English
+%1[%2]:%3%n
+%4%n
+%5%n
+%6%n
+%7%n
+%8%n
+%9%n
+%10
+.
+MessageId=0x8
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_08
+Language=English
+%1[%2]:%3%n
+%4%n
+%5%n
+%6%n
+%7%n
+%8%n
+%9%n
+%10%n
+%11
+.
+MessageId=0x9
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_09
+Language=English
+%1[%2]:%3%n
+%4%n
+%5%n
+%6%n
+%7%n
+%8%n
+%9%n
+%10%n
+%11%n
+%12
+.
+MessageId=0xa
+Severity=Success
+Facility=Application
+SymbolicName=MSG_SYSLOG_10
+Language=English
+%1[%2]:%3%n
+%4%n
+%5%n
+%6%n
+%7%n
+%8%n
+%9%n
+%10%n
+%11%n
+%12%n
+%13
+.
diff --git a/os_win32/syslogevt_vc6.dsp b/os_win32/syslogevt_vc6.dsp
new file mode 100644 (file)
index 0000000..3f8a8af
--- /dev/null
@@ -0,0 +1,148 @@
+# Microsoft Developer Studio Project File - Name="syslogevt_vc6" - Package Owner=<4>\r
+# Microsoft Developer Studio Generated Build File, Format Version 6.00\r
+# ** NICHT BEARBEITEN **\r
+\r
+# TARGTYPE "Win32 (x86) Console Application" 0x0103\r
+\r
+CFG=syslogevt_vc6 - Win32 Debug\r
+!MESSAGE Dies ist kein gültiges Makefile. Zum Erstellen dieses Projekts mit NMAKE\r
+!MESSAGE verwenden Sie den Befehl "Makefile exportieren" und führen Sie den Befehl\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "syslogevt_vc6.mak".\r
+!MESSAGE \r
+!MESSAGE Sie können beim Ausführen von NMAKE eine Konfiguration angeben\r
+!MESSAGE durch Definieren des Makros CFG in der Befehlszeile. Zum Beispiel:\r
+!MESSAGE \r
+!MESSAGE NMAKE /f "syslogevt_vc6.mak" CFG="syslogevt_vc6 - Win32 Debug"\r
+!MESSAGE \r
+!MESSAGE Für die Konfiguration stehen zur Auswahl:\r
+!MESSAGE \r
+!MESSAGE "syslogevt_vc6 - Win32 Release" (basierend auf  "Win32 (x86) Console Application")\r
+!MESSAGE "syslogevt_vc6 - Win32 Debug" (basierend auf  "Win32 (x86) Console Application")\r
+!MESSAGE \r
+\r
+# Begin Project\r
+# PROP AllowPerConfigDependencies 0\r
+# PROP Scc_ProjName ""\r
+# PROP Scc_LocalPath ""\r
+CPP=cl.exe\r
+RSC=rc.exe\r
+\r
+!IF  "$(CFG)" == "syslogevt_vc6 - Win32 Release"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 0\r
+# PROP BASE Output_Dir "Release"\r
+# PROP BASE Intermediate_Dir "Release"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 0\r
+# PROP Output_Dir "syslogevt.r"\r
+# PROP Intermediate_Dir "syslogevt.r"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD CPP /nologo /MD /W3 /GX /O1 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c\r
+# ADD BASE RSC /l 0x407 /d "NDEBUG"\r
+# ADD RSC /l 0x407 /d "NDEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386\r
+# ADD LINK32 $(IntDir)\syslogevt.res kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386 /out:"syslogevt.exe"\r
+# SUBTRACT LINK32 /pdb:none\r
+# Begin Special Build Tool\r
+IntDir=.\syslogevt.r\r
+SOURCE="$(InputPath)"\r
+PreLink_Desc=Compiling Resources\r
+PreLink_Cmds=rc $(IntDir)\syslogevt.rc\r
+# End Special Build Tool\r
+\r
+!ELSEIF  "$(CFG)" == "syslogevt_vc6 - Win32 Debug"\r
+\r
+# PROP BASE Use_MFC 0\r
+# PROP BASE Use_Debug_Libraries 1\r
+# PROP BASE Output_Dir "Debug"\r
+# PROP BASE Intermediate_Dir "Debug"\r
+# PROP BASE Target_Dir ""\r
+# PROP Use_MFC 0\r
+# PROP Use_Debug_Libraries 1\r
+# PROP Output_Dir "syslogevt.d"\r
+# PROP Intermediate_Dir "syslogevt.d"\r
+# PROP Ignore_Export_Lib 0\r
+# PROP Target_Dir ""\r
+# ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /GZ /c\r
+# ADD BASE RSC /l 0x407 /d "_DEBUG"\r
+# ADD RSC /l 0x407 /d "_DEBUG"\r
+BSC32=bscmake.exe\r
+# ADD BASE BSC32 /nologo\r
+# ADD BSC32 /nologo\r
+LINK32=link.exe\r
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# ADD LINK32 $(IntDir)\syslogevt.res kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept\r
+# Begin Special Build Tool\r
+IntDir=.\syslogevt.d\r
+SOURCE="$(InputPath)"\r
+PreLink_Desc=Compiling Resources\r
+PreLink_Cmds=rc $(IntDir)\syslogevt.rc\r
+# End Special Build Tool\r
+\r
+!ENDIF \r
+\r
+# Begin Target\r
+\r
+# Name "syslogevt_vc6 - Win32 Release"\r
+# Name "syslogevt_vc6 - Win32 Debug"\r
+# Begin Source File\r
+\r
+SOURCE=.\syslogevt.c\r
+# End Source File\r
+# Begin Source File\r
+\r
+SOURCE=.\syslogevt.mc\r
+\r
+!IF  "$(CFG)" == "syslogevt_vc6 - Win32 Release"\r
+\r
+# Begin Custom Build - Compiling Messages\r
+IntDir=.\syslogevt.r\r
+InputPath=.\syslogevt.mc\r
+\r
+BuildCmds= \\r
+       mc -r $(IntDir) syslogevt.mc\r
+\r
+"$(IntDir)\syslogevt.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+   $(BuildCmds)\r
+\r
+"$(IntDir)\msg00001.bin" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+   $(BuildCmds)\r
+\r
+"syslogevt.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+   $(BuildCmds)\r
+# End Custom Build\r
+\r
+!ELSEIF  "$(CFG)" == "syslogevt_vc6 - Win32 Debug"\r
+\r
+# Begin Custom Build - Compiling Messages\r
+IntDir=.\syslogevt.d\r
+InputPath=.\syslogevt.mc\r
+\r
+BuildCmds= \\r
+       mc -r $(IntDir) syslogevt.mc\r
+\r
+"$(IntDir)\syslogevt.rc" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+   $(BuildCmds)\r
+\r
+"$(IntDir)\msg00001.bin" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+   $(BuildCmds)\r
+\r
+"syslogevt.h" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"\r
+   $(BuildCmds)\r
+# End Custom Build\r
+\r
+!ENDIF \r
+\r
+# End Source File\r
+# End Target\r
+# End Project\r
diff --git a/posix/getopt.c b/posix/getopt.c
new file mode 100644 (file)
index 0000000..289d137
--- /dev/null
@@ -0,0 +1,1277 @@
+/* Getopt for GNU.
+   NOTE: getopt is now part of the C library, so if you don't know what
+   "Keep this file name-space clean" means, talk to drepper@gnu.org
+   before changing it!
+   Copyright (C) 1987,88,89,90,91,92,93,94,95,96,98,99,2000,2001,2002
+       Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+\f
+/* This tells Alpha OSF/1 not to define a getopt prototype in <stdio.h>.
+   Ditto for AIX 3.2 and <stdlib.h>.  */
+#ifndef _NO_PROTO
+# define _NO_PROTO
+#endif
+
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#if !defined __STDC__ || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+# ifndef const
+#  define const
+# endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+# include <gnu-versions.h>
+# if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#  define ELIDE_CODE
+# endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef __GNU_LIBRARY__
+/* Don't include stdlib.h for non-GNU C libraries because some of them
+   contain conflicting prototypes for getopt.  */
+# include <stdlib.h>
+# include <unistd.h>
+#endif /* GNU C library.  */
+
+#ifdef VMS
+# include <unixlib.h>
+# if HAVE_STRING_H - 0
+#  include <string.h>
+# endif
+#endif
+
+#ifndef _
+/* This is for other GNU distributions with internationalized messages.  */
+# if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
+#  include <libintl.h>
+#  ifndef _
+#   define _(msgid)    gettext (msgid)
+#  endif
+# else
+#  define _(msgid)     (msgid)
+# endif
+# if defined _LIBC && defined USE_IN_LIBIO
+#  include <wchar.h>
+# endif
+#endif
+
+#ifndef attribute_hidden
+# define attribute_hidden
+#endif
+
+/* This version of `getopt' appears to the caller like standard Unix `getopt'
+   but it behaves differently for the user, since it allows the user
+   to intersperse the options with the other arguments.
+
+   As `getopt' works, it permutes the elements of ARGV so that,
+   when it is done, all the options precede everything else.  Thus
+   all application programs are extended to handle flexible argument order.
+
+   Setting the environment variable POSIXLY_CORRECT disables permutation.
+   Then the behavior is completely standard.
+
+   GNU application programs can use a third alternative mode in which
+   they can distinguish the relative order of options and other arguments.  */
+
+#include "getopt.h"
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+/* 1003.2 says this must be 1 before any call.  */
+int optind = 1;
+
+/* Formerly, initialization of getopt depended on optind==0, which
+   causes problems with re-calling getopt as programs generally don't
+   know that. */
+
+int __getopt_initialized attribute_hidden;
+
+/* The next char to be scanned in the option-element
+   in which the last option character we returned was found.
+   This allows us to pick up the scan where we left off.
+
+   If this is zero, or a null string, it means resume the scan
+   by advancing to the next ARGV-element.  */
+
+static char *nextchar;
+
+/* Callers store zero here to inhibit the error message
+   for unrecognized options.  */
+
+int opterr = 1;
+
+/* Set to an option character which was unrecognized.
+   This must be initialized on some systems to avoid linking in the
+   system's own getopt implementation.  */
+
+int optopt = '?';
+
+/* Describe how to deal with options that follow non-option ARGV-elements.
+
+   If the caller did not specify anything,
+   the default is REQUIRE_ORDER if the environment variable
+   POSIXLY_CORRECT is defined, PERMUTE otherwise.
+
+   REQUIRE_ORDER means don't recognize them as options;
+   stop option processing when the first non-option is seen.
+   This is what Unix does.
+   This mode of operation is selected by either setting the environment
+   variable POSIXLY_CORRECT, or using `+' as the first character
+   of the list of option characters.
+
+   PERMUTE is the default.  We permute the contents of ARGV as we scan,
+   so that eventually all the non-options are at the end.  This allows options
+   to be given in any order, even with programs that were not written to
+   expect this.
+
+   RETURN_IN_ORDER is an option available to programs that were written
+   to expect options and other ARGV-elements in any order and that care about
+   the ordering of the two.  We describe each non-option ARGV-element
+   as if it were the argument of an option with character code 1.
+   Using `-' as the first character of the list of option characters
+   selects this mode of operation.
+
+   The special argument `--' forces an end of option-scanning regardless
+   of the value of `ordering'.  In the case of RETURN_IN_ORDER, only
+   `--' can cause `getopt' to return -1 with `optind' != ARGC.  */
+
+static enum
+{
+  REQUIRE_ORDER, PERMUTE, RETURN_IN_ORDER
+} ordering;
+
+/* Value of POSIXLY_CORRECT environment variable.  */
+static char *posixly_correct;
+\f
+#ifdef __GNU_LIBRARY__
+/* We want to avoid inclusion of string.h with non-GNU libraries
+   because there are many ways it can cause trouble.
+   On some systems, it contains special magic macros that don't work
+   in GCC.  */
+# include <string.h>
+# define my_index      strchr
+#else
+
+# if HAVE_STRING_H
+#  include <string.h>
+# else
+#  include <strings.h>
+# endif
+
+/* Avoid depending on library functions or files
+   whose names are inconsistent.  */
+
+#ifndef getenv
+extern char *getenv ();
+#endif
+
+static char *
+my_index (str, chr)
+     const char *str;
+     int chr;
+{
+  while (*str)
+    {
+      if (*str == chr)
+       return (char *) str;
+      str++;
+    }
+  return 0;
+}
+
+/* If using GCC, we can safely declare strlen this way.
+   If not using GCC, it is ok not to declare it.  */
+#ifdef __GNUC__
+/* Note that Motorola Delta 68k R3V7 comes with GCC but not stddef.h.
+   That was relevant to code that was here before.  */
+# if (!defined __STDC__ || !__STDC__) && !defined strlen
+/* gcc with -traditional declares the built-in strlen to return int,
+   and has done so at least since version 2.4.5. -- rms.  */
+extern int strlen (const char *);
+# endif /* not __STDC__ */
+#endif /* __GNUC__ */
+
+#endif /* not __GNU_LIBRARY__ */
+\f
+/* Handle permutation of arguments.  */
+
+/* Describe the part of ARGV that contains non-options that have
+   been skipped.  `first_nonopt' is the index in ARGV of the first of them;
+   `last_nonopt' is the index after the last of them.  */
+
+static int first_nonopt;
+static int last_nonopt;
+
+#ifdef _LIBC
+/* Stored original parameters.
+   XXX This is no good solution.  We should rather copy the args so
+   that we can compare them later.  But we must not use malloc(3).  */
+extern int __libc_argc;
+extern char **__libc_argv;
+
+/* Bash 2.0 gives us an environment variable containing flags
+   indicating ARGV elements that should not be considered arguments.  */
+
+# ifdef USE_NONOPTION_FLAGS
+/* Defined in getopt_init.c  */
+extern char *__getopt_nonoption_flags;
+
+static int nonoption_flags_max_len;
+static int nonoption_flags_len;
+# endif
+
+# ifdef USE_NONOPTION_FLAGS
+#  define SWAP_FLAGS(ch1, ch2) \
+  if (nonoption_flags_len > 0)                                               \
+    {                                                                        \
+      char __tmp = __getopt_nonoption_flags[ch1];                            \
+      __getopt_nonoption_flags[ch1] = __getopt_nonoption_flags[ch2];         \
+      __getopt_nonoption_flags[ch2] = __tmp;                                 \
+    }
+# else
+#  define SWAP_FLAGS(ch1, ch2)
+# endif
+#else  /* !_LIBC */
+# define SWAP_FLAGS(ch1, ch2)
+#endif /* _LIBC */
+
+/* Exchange two adjacent subsequences of ARGV.
+   One subsequence is elements [first_nonopt,last_nonopt)
+   which contains all the non-options that have been skipped so far.
+   The other is elements [last_nonopt,optind), which contains all
+   the options processed since those non-options were skipped.
+
+   `first_nonopt' and `last_nonopt' are relocated so that they describe
+   the new indices of the non-options in ARGV after they are moved.  */
+
+#if defined __STDC__ && __STDC__
+static void exchange (char **);
+#endif
+
+static void
+exchange (argv)
+     char **argv;
+{
+  int bottom = first_nonopt;
+  int middle = last_nonopt;
+  int top = optind;
+  char *tem;
+
+  /* Exchange the shorter segment with the far end of the longer segment.
+     That puts the shorter segment into the right place.
+     It leaves the longer segment in the right place overall,
+     but it consists of two parts that need to be swapped next.  */
+
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+  /* First make sure the handling of the `__getopt_nonoption_flags'
+     string can work normally.  Our top argument must be in the range
+     of the string.  */
+  if (nonoption_flags_len > 0 && top >= nonoption_flags_max_len)
+    {
+      /* We must extend the array.  The user plays games with us and
+        presents new arguments.  */
+      char *new_str = malloc (top + 1);
+      if (new_str == NULL)
+       nonoption_flags_len = nonoption_flags_max_len = 0;
+      else
+       {
+         memset (__mempcpy (new_str, __getopt_nonoption_flags,
+                            nonoption_flags_max_len),
+                 '\0', top + 1 - nonoption_flags_max_len);
+         nonoption_flags_max_len = top + 1;
+         __getopt_nonoption_flags = new_str;
+       }
+    }
+#endif
+
+  while (top > middle && middle > bottom)
+    {
+      if (top - middle > middle - bottom)
+       {
+         /* Bottom segment is the short one.  */
+         int len = middle - bottom;
+         register int i;
+
+         /* Swap it with the top part of the top segment.  */
+         for (i = 0; i < len; i++)
+           {
+             tem = argv[bottom + i];
+             argv[bottom + i] = argv[top - (middle - bottom) + i];
+             argv[top - (middle - bottom) + i] = tem;
+             SWAP_FLAGS (bottom + i, top - (middle - bottom) + i);
+           }
+         /* Exclude the moved bottom segment from further swapping.  */
+         top -= len;
+       }
+      else
+       {
+         /* Top segment is the short one.  */
+         int len = top - middle;
+         register int i;
+
+         /* Swap it with the bottom part of the bottom segment.  */
+         for (i = 0; i < len; i++)
+           {
+             tem = argv[bottom + i];
+             argv[bottom + i] = argv[middle + i];
+             argv[middle + i] = tem;
+             SWAP_FLAGS (bottom + i, middle + i);
+           }
+         /* Exclude the moved top segment from further swapping.  */
+         bottom += len;
+       }
+    }
+
+  /* Update records for the slots the non-options now occupy.  */
+
+  first_nonopt += (optind - last_nonopt);
+  last_nonopt = optind;
+}
+
+/* Initialize the internal data when the first call is made.  */
+
+#if defined __STDC__ && __STDC__
+static const char *_getopt_initialize (int, char *const *, const char *);
+#endif
+static const char *
+_getopt_initialize (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  /* Start processing options with ARGV-element 1 (since ARGV-element 0
+     is the program name); the sequence of previously skipped
+     non-option ARGV-elements is empty.  */
+
+  first_nonopt = last_nonopt = optind;
+
+  nextchar = NULL;
+
+  posixly_correct = getenv ("POSIXLY_CORRECT");
+
+  /* Determine how to handle the ordering of options and nonoptions.  */
+
+  if (optstring[0] == '-')
+    {
+      ordering = RETURN_IN_ORDER;
+      ++optstring;
+    }
+  else if (optstring[0] == '+')
+    {
+      ordering = REQUIRE_ORDER;
+      ++optstring;
+    }
+  else if (posixly_correct != NULL)
+    ordering = REQUIRE_ORDER;
+  else
+    ordering = PERMUTE;
+
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+  if (posixly_correct == NULL
+      && argc == __libc_argc && argv == __libc_argv)
+    {
+      if (nonoption_flags_max_len == 0)
+       {
+         if (__getopt_nonoption_flags == NULL
+             || __getopt_nonoption_flags[0] == '\0')
+           nonoption_flags_max_len = -1;
+         else
+           {
+             const char *orig_str = __getopt_nonoption_flags;
+             int len = nonoption_flags_max_len = strlen (orig_str);
+             if (nonoption_flags_max_len < argc)
+               nonoption_flags_max_len = argc;
+             __getopt_nonoption_flags =
+               (char *) malloc (nonoption_flags_max_len);
+             if (__getopt_nonoption_flags == NULL)
+               nonoption_flags_max_len = -1;
+             else
+               memset (__mempcpy (__getopt_nonoption_flags, orig_str, len),
+                       '\0', nonoption_flags_max_len - len);
+           }
+       }
+      nonoption_flags_len = nonoption_flags_max_len;
+    }
+  else
+    nonoption_flags_len = 0;
+#endif
+
+  return optstring;
+}
+\f
+/* Scan elements of ARGV (whose length is ARGC) for option characters
+   given in OPTSTRING.
+
+   If an element of ARGV starts with '-', and is not exactly "-" or "--",
+   then it is an option element.  The characters of this element
+   (aside from the initial '-') are option characters.  If `getopt'
+   is called repeatedly, it returns successively each of the option characters
+   from each of the option elements.
+
+   If `getopt' finds another option character, it returns that character,
+   updating `optind' and `nextchar' so that the next call to `getopt' can
+   resume the scan with the following option character or ARGV-element.
+
+   If there are no more option characters, `getopt' returns -1.
+   Then `optind' is the index in ARGV of the first ARGV-element
+   that is not an option.  (The ARGV-elements have been permuted
+   so that those that are not options now come last.)
+
+   OPTSTRING is a string containing the legitimate option characters.
+   If an option character is seen that is not listed in OPTSTRING,
+   return '?' after printing an error message.  If you set `opterr' to
+   zero, the error message is suppressed but we still return '?'.
+
+   If a char in OPTSTRING is followed by a colon, that means it wants an arg,
+   so the following text in the same ARGV-element, or the text of the following
+   ARGV-element, is returned in `optarg'.  Two colons mean an option that
+   wants an optional arg; if there is text in the current ARGV-element,
+   it is returned in `optarg', otherwise `optarg' is set to zero.
+
+   If OPTSTRING starts with `-' or `+', it requests different methods of
+   handling the non-option ARGV-elements.
+   See the comments about RETURN_IN_ORDER and REQUIRE_ORDER, above.
+
+   Long-named options begin with `--' instead of `-'.
+   Their names may be abbreviated as long as the abbreviation is unique
+   or is an exact match for some defined option.  If they have an
+   argument, it follows the option name in the same ARGV-element, separated
+   from the option name by a `=', or else the in next ARGV-element.
+   When `getopt' finds a long-named option, it returns 0 if that option's
+   `flag' field is nonzero, the value of the option's `val' field
+   if the `flag' field is zero.
+
+   The elements of ARGV aren't really const, because we permute them.
+   But we pretend they're const in the prototype to be compatible
+   with other systems.
+
+   LONGOPTS is a vector of `struct option' terminated by an
+   element containing a name which is zero.
+
+   LONGIND returns the index in LONGOPT of the long-named option found.
+   It is only valid when a long-named option has been found by the most
+   recent call.
+
+   If LONG_ONLY is nonzero, '-' as well as '--' can introduce
+   long-named options.  */
+
+int
+_getopt_internal (argc, argv, optstring, longopts, longind, long_only)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+     const struct option *longopts;
+     int *longind;
+     int long_only;
+{
+  int print_errors = opterr;
+  if (optstring[0] == ':')
+    print_errors = 0;
+
+  if (argc < 1)
+    return -1;
+
+  optarg = NULL;
+
+  if (optind == 0 || !__getopt_initialized)
+    {
+      if (optind == 0)
+       optind = 1;     /* Don't scan ARGV[0], the program name.  */
+      optstring = _getopt_initialize (argc, argv, optstring);
+      __getopt_initialized = 1;
+    }
+
+  /* Test whether ARGV[optind] points to a non-option argument.
+     Either it does not have option syntax, or there is an environment flag
+     from the shell indicating it is not an option.  The later information
+     is only used when the used in the GNU libc.  */
+#if defined _LIBC && defined USE_NONOPTION_FLAGS
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0'              \
+                     || (optind < nonoption_flags_len                        \
+                         && __getopt_nonoption_flags[optind] == '1'))
+#else
+# define NONOPTION_P (argv[optind][0] != '-' || argv[optind][1] == '\0')
+#endif
+
+  if (nextchar == NULL || *nextchar == '\0')
+    {
+      /* Advance to the next ARGV-element.  */
+
+      /* Give FIRST_NONOPT & LAST_NONOPT rational values if OPTIND has been
+        moved back by the user (who may also have changed the arguments).  */
+      if (last_nonopt > optind)
+       last_nonopt = optind;
+      if (first_nonopt > optind)
+       first_nonopt = optind;
+
+      if (ordering == PERMUTE)
+       {
+         /* If we have just processed some options following some non-options,
+            exchange them so that the options come first.  */
+
+         if (first_nonopt != last_nonopt && last_nonopt != optind)
+           exchange ((char **) argv);
+         else if (last_nonopt != optind)
+           first_nonopt = optind;
+
+         /* Skip any additional non-options
+            and extend the range of non-options previously skipped.  */
+
+         while (optind < argc && NONOPTION_P)
+           optind++;
+         last_nonopt = optind;
+       }
+
+      /* The special ARGV-element `--' means premature end of options.
+        Skip it like a null option,
+        then exchange with previous non-options as if it were an option,
+        then skip everything else like a non-option.  */
+
+      if (optind != argc && !strcmp (argv[optind], "--"))
+       {
+         optind++;
+
+         if (first_nonopt != last_nonopt && last_nonopt != optind)
+           exchange ((char **) argv);
+         else if (first_nonopt == last_nonopt)
+           first_nonopt = optind;
+         last_nonopt = argc;
+
+         optind = argc;
+       }
+
+      /* If we have done all the ARGV-elements, stop the scan
+        and back over any non-options that we skipped and permuted.  */
+
+      if (optind == argc)
+       {
+         /* Set the next-arg-index to point at the non-options
+            that we previously skipped, so the caller will digest them.  */
+         if (first_nonopt != last_nonopt)
+           optind = first_nonopt;
+         return -1;
+       }
+
+      /* If we have come to a non-option and did not permute it,
+        either stop the scan or describe it to the caller and pass it by.  */
+
+      if (NONOPTION_P)
+       {
+         if (ordering == REQUIRE_ORDER)
+           return -1;
+         optarg = argv[optind++];
+         return 1;
+       }
+
+      /* We have found another option-ARGV-element.
+        Skip the initial punctuation.  */
+
+      nextchar = (argv[optind] + 1
+                 + (longopts != NULL && argv[optind][1] == '-'));
+    }
+
+  /* Decode the current option-ARGV-element.  */
+
+  /* Check whether the ARGV-element is a long option.
+
+     If long_only and the ARGV-element has the form "-f", where f is
+     a valid short option, don't consider it an abbreviated form of
+     a long option that starts with f.  Otherwise there would be no
+     way to give the -f short option.
+
+     On the other hand, if there's a long option "fubar" and
+     the ARGV-element is "-fu", do consider that an abbreviation of
+     the long option, just like "--fu", and not "-f" with arg "u".
+
+     This distinction seems to be the most useful approach.  */
+
+  if (longopts != NULL
+      && (argv[optind][1] == '-'
+         || (long_only && (argv[optind][2] || !my_index (optstring, argv[optind][1])))))
+    {
+      char *nameend;
+      const struct option *p;
+      const struct option *pfound = NULL;
+      int exact = 0;
+      int ambig = 0;
+      int indfound = -1;
+      int option_index;
+
+      for (nameend = nextchar; *nameend && *nameend != '='; nameend++)
+       /* Do nothing.  */ ;
+
+      /* Test all long options for either exact match
+        or abbreviated matches.  */
+      for (p = longopts, option_index = 0; p->name; p++, option_index++)
+       if (!strncmp (p->name, nextchar, nameend - nextchar))
+         {
+           if ((unsigned int) (nameend - nextchar)
+               == (unsigned int) strlen (p->name))
+             {
+               /* Exact match found.  */
+               pfound = p;
+               indfound = option_index;
+               exact = 1;
+               break;
+             }
+           else if (pfound == NULL)
+             {
+               /* First nonexact match found.  */
+               pfound = p;
+               indfound = option_index;
+             }
+           else if (long_only
+                    || pfound->has_arg != p->has_arg
+                    || pfound->flag != p->flag
+                    || pfound->val != p->val)
+             /* Second or later nonexact match found.  */
+             ambig = 1;
+         }
+
+      if (ambig && !exact)
+       {
+         if (print_errors)
+           {
+#if defined _LIBC && defined USE_IN_LIBIO
+             char *buf;
+
+             if (__asprintf (&buf, _("%s: option `%s' is ambiguous\n"),
+                             argv[0], argv[optind]) >= 0)
+               {
+
+                 if (_IO_fwide (stderr, 0) > 0)
+                   __fwprintf (stderr, L"%s", buf);
+                 else
+                   fputs (buf, stderr);
+
+                 free (buf);
+               }
+#else
+             fprintf (stderr, _("%s: option `%s' is ambiguous\n"),
+                      argv[0], argv[optind]);
+#endif
+           }
+         nextchar += strlen (nextchar);
+         optind++;
+         optopt = 0;
+         return '?';
+       }
+
+      if (pfound != NULL)
+       {
+         option_index = indfound;
+         optind++;
+         if (*nameend)
+           {
+             /* Don't test has_arg with >, because some C compilers don't
+                allow it to be used on enums.  */
+             if (pfound->has_arg)
+               optarg = nameend + 1;
+             else
+               {
+                 if (print_errors)
+                   {
+#if defined _LIBC && defined USE_IN_LIBIO
+                     char *buf;
+                     int n;
+#endif
+
+                     if (argv[optind - 1][1] == '-')
+                       {
+                         /* --option */
+#if defined _LIBC && defined USE_IN_LIBIO
+                         n = __asprintf (&buf, _("\
+%s: option `--%s' doesn't allow an argument\n"),
+                                         argv[0], pfound->name);
+#else
+                         fprintf (stderr, _("\
+%s: option `--%s' doesn't allow an argument\n"),
+                                  argv[0], pfound->name);
+#endif
+                       }
+                     else
+                       {
+                         /* +option or -option */
+#if defined _LIBC && defined USE_IN_LIBIO
+                         n = __asprintf (&buf, _("\
+%s: option `%c%s' doesn't allow an argument\n"),
+                                         argv[0], argv[optind - 1][0],
+                                         pfound->name);
+#else
+                         fprintf (stderr, _("\
+%s: option `%c%s' doesn't allow an argument\n"),
+                                  argv[0], argv[optind - 1][0], pfound->name);
+#endif
+                       }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+                     if (n >= 0)
+                       {
+                         if (_IO_fwide (stderr, 0) > 0)
+                           __fwprintf (stderr, L"%s", buf);
+                         else
+                           fputs (buf, stderr);
+
+                         free (buf);
+                       }
+#endif
+                   }
+
+                 nextchar += strlen (nextchar);
+
+                 optopt = pfound->val;
+                 return '?';
+               }
+           }
+         else if (pfound->has_arg == 1)
+           {
+             if (optind < argc)
+               optarg = argv[optind++];
+             else
+               {
+                 if (print_errors)
+                   {
+#if defined _LIBC && defined USE_IN_LIBIO
+                     char *buf;
+
+                     if (__asprintf (&buf, _("\
+%s: option `%s' requires an argument\n"),
+                                     argv[0], argv[optind - 1]) >= 0)
+                       {
+                         if (_IO_fwide (stderr, 0) > 0)
+                           __fwprintf (stderr, L"%s", buf);
+                         else
+                           fputs (buf, stderr);
+
+                         free (buf);
+                       }
+#else
+                     fprintf (stderr,
+                              _("%s: option `%s' requires an argument\n"),
+                              argv[0], argv[optind - 1]);
+#endif
+                   }
+                 nextchar += strlen (nextchar);
+                 optopt = pfound->val;
+                 return optstring[0] == ':' ? ':' : '?';
+               }
+           }
+         nextchar += strlen (nextchar);
+         if (longind != NULL)
+           *longind = option_index;
+         if (pfound->flag)
+           {
+             *(pfound->flag) = pfound->val;
+             return 0;
+           }
+         return pfound->val;
+       }
+
+      /* Can't find it as a long option.  If this is not getopt_long_only,
+        or the option starts with '--' or is not a valid short
+        option, then it's an error.
+        Otherwise interpret it as a short option.  */
+      if (!long_only || argv[optind][1] == '-'
+         || my_index (optstring, *nextchar) == NULL)
+       {
+         if (print_errors)
+           {
+#if defined _LIBC && defined USE_IN_LIBIO
+             char *buf;
+             int n;
+#endif
+
+             if (argv[optind][1] == '-')
+               {
+                 /* --option */
+#if defined _LIBC && defined USE_IN_LIBIO
+                 n = __asprintf (&buf, _("%s: unrecognized option `--%s'\n"),
+                                 argv[0], nextchar);
+#else
+                 fprintf (stderr, _("%s: unrecognized option `--%s'\n"),
+                          argv[0], nextchar);
+#endif
+               }
+             else
+               {
+                 /* +option or -option */
+#if defined _LIBC && defined USE_IN_LIBIO
+                 n = __asprintf (&buf, _("%s: unrecognized option `%c%s'\n"),
+                                 argv[0], argv[optind][0], nextchar);
+#else
+                 fprintf (stderr, _("%s: unrecognized option `%c%s'\n"),
+                          argv[0], argv[optind][0], nextchar);
+#endif
+               }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+             if (n >= 0)
+               {
+                 if (_IO_fwide (stderr, 0) > 0)
+                   __fwprintf (stderr, L"%s", buf);
+                 else
+                   fputs (buf, stderr);
+
+                 free (buf);
+               }
+#endif
+           }
+         nextchar = (char *) "";
+         optind++;
+         optopt = 0;
+         return '?';
+       }
+    }
+
+  /* Look at and handle the next short option-character.  */
+
+  {
+    char c = *nextchar++;
+    char *temp = my_index (optstring, c);
+
+    /* Increment `optind' when we start to process its last character.  */
+    if (*nextchar == '\0')
+      ++optind;
+
+    if (temp == NULL || c == ':')
+      {
+       if (print_errors)
+         {
+#if defined _LIBC && defined USE_IN_LIBIO
+             char *buf;
+             int n;
+#endif
+
+           if (posixly_correct)
+             {
+               /* 1003.2 specifies the format of this message.  */
+#if defined _LIBC && defined USE_IN_LIBIO
+               n = __asprintf (&buf, _("%s: illegal option -- %c\n"),
+                               argv[0], c);
+#else
+               fprintf (stderr, _("%s: illegal option -- %c\n"), argv[0], c);
+#endif
+             }
+           else
+             {
+#if defined _LIBC && defined USE_IN_LIBIO
+               n = __asprintf (&buf, _("%s: invalid option -- %c\n"),
+                               argv[0], c);
+#else
+               fprintf (stderr, _("%s: invalid option -- %c\n"), argv[0], c);
+#endif
+             }
+
+#if defined _LIBC && defined USE_IN_LIBIO
+           if (n >= 0)
+             {
+               if (_IO_fwide (stderr, 0) > 0)
+                 __fwprintf (stderr, L"%s", buf);
+               else
+                 fputs (buf, stderr);
+
+               free (buf);
+             }
+#endif
+         }
+       optopt = c;
+       return '?';
+      }
+    /* Convenience. Treat POSIX -W foo same as long option --foo */
+    if (temp[0] == 'W' && temp[1] == ';')
+      {
+       char *nameend;
+       const struct option *p;
+       const struct option *pfound = NULL;
+       int exact = 0;
+       int ambig = 0;
+       int indfound = 0;
+       int option_index;
+
+       /* This is an option that requires an argument.  */
+       if (*nextchar != '\0')
+         {
+           optarg = nextchar;
+           /* If we end this ARGV-element by taking the rest as an arg,
+              we must advance to the next element now.  */
+           optind++;
+         }
+       else if (optind == argc)
+         {
+           if (print_errors)
+             {
+               /* 1003.2 specifies the format of this message.  */
+#if defined _LIBC && defined USE_IN_LIBIO
+               char *buf;
+
+               if (__asprintf (&buf,
+                               _("%s: option requires an argument -- %c\n"),
+                               argv[0], c) >= 0)
+                 {
+                   if (_IO_fwide (stderr, 0) > 0)
+                     __fwprintf (stderr, L"%s", buf);
+                   else
+                     fputs (buf, stderr);
+
+                   free (buf);
+                 }
+#else
+               fprintf (stderr, _("%s: option requires an argument -- %c\n"),
+                        argv[0], c);
+#endif
+             }
+           optopt = c;
+           if (optstring[0] == ':')
+             c = ':';
+           else
+             c = '?';
+           return c;
+         }
+       else
+         /* We already incremented `optind' once;
+            increment it again when taking next ARGV-elt as argument.  */
+         optarg = argv[optind++];
+
+       /* optarg is now the argument, see if it's in the
+          table of longopts.  */
+
+       for (nextchar = nameend = optarg; *nameend && *nameend != '='; nameend++)
+         /* Do nothing.  */ ;
+
+       /* Test all long options for either exact match
+          or abbreviated matches.  */
+       for (p = longopts, option_index = 0; p->name; p++, option_index++)
+         if (!strncmp (p->name, nextchar, nameend - nextchar))
+           {
+             if ((unsigned int) (nameend - nextchar) == strlen (p->name))
+               {
+                 /* Exact match found.  */
+                 pfound = p;
+                 indfound = option_index;
+                 exact = 1;
+                 break;
+               }
+             else if (pfound == NULL)
+               {
+                 /* First nonexact match found.  */
+                 pfound = p;
+                 indfound = option_index;
+               }
+             else
+               /* Second or later nonexact match found.  */
+               ambig = 1;
+           }
+       if (ambig && !exact)
+         {
+           if (print_errors)
+             {
+#if defined _LIBC && defined USE_IN_LIBIO
+               char *buf;
+
+               if (__asprintf (&buf, _("%s: option `-W %s' is ambiguous\n"),
+                               argv[0], argv[optind]) >= 0)
+                 {
+                   if (_IO_fwide (stderr, 0) > 0)
+                     __fwprintf (stderr, L"%s", buf);
+                   else
+                     fputs (buf, stderr);
+
+                   free (buf);
+                 }
+#else
+               fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"),
+                        argv[0], argv[optind]);
+#endif
+             }
+           nextchar += strlen (nextchar);
+           optind++;
+           return '?';
+         }
+       if (pfound != NULL)
+         {
+           option_index = indfound;
+           if (*nameend)
+             {
+               /* Don't test has_arg with >, because some C compilers don't
+                  allow it to be used on enums.  */
+               if (pfound->has_arg)
+                 optarg = nameend + 1;
+               else
+                 {
+                   if (print_errors)
+                     {
+#if defined _LIBC && defined USE_IN_LIBIO
+                       char *buf;
+
+                       if (__asprintf (&buf, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+                                       argv[0], pfound->name) >= 0)
+                         {
+                           if (_IO_fwide (stderr, 0) > 0)
+                             __fwprintf (stderr, L"%s", buf);
+                           else
+                             fputs (buf, stderr);
+
+                           free (buf);
+                         }
+#else
+                       fprintf (stderr, _("\
+%s: option `-W %s' doesn't allow an argument\n"),
+                                argv[0], pfound->name);
+#endif
+                     }
+
+                   nextchar += strlen (nextchar);
+                   return '?';
+                 }
+             }
+           else if (pfound->has_arg == 1)
+             {
+               if (optind < argc)
+                 optarg = argv[optind++];
+               else
+                 {
+                   if (print_errors)
+                     {
+#if defined _LIBC && defined USE_IN_LIBIO
+                       char *buf;
+
+                       if (__asprintf (&buf, _("\
+%s: option `%s' requires an argument\n"),
+                                       argv[0], argv[optind - 1]) >= 0)
+                         {
+                           if (_IO_fwide (stderr, 0) > 0)
+                             __fwprintf (stderr, L"%s", buf);
+                           else
+                             fputs (buf, stderr);
+
+                           free (buf);
+                         }
+#else
+                       fprintf (stderr,
+                                _("%s: option `%s' requires an argument\n"),
+                                argv[0], argv[optind - 1]);
+#endif
+                     }
+                   nextchar += strlen (nextchar);
+                   return optstring[0] == ':' ? ':' : '?';
+                 }
+             }
+           nextchar += strlen (nextchar);
+           if (longind != NULL)
+             *longind = option_index;
+           if (pfound->flag)
+             {
+               *(pfound->flag) = pfound->val;
+               return 0;
+             }
+           return pfound->val;
+         }
+         nextchar = NULL;
+         return 'W';   /* Let the application handle it.   */
+      }
+    if (temp[1] == ':')
+      {
+       if (temp[2] == ':')
+         {
+           /* This is an option that accepts an argument optionally.  */
+           if (*nextchar != '\0')
+             {
+               optarg = nextchar;
+               optind++;
+             }
+           else
+             optarg = NULL;
+           nextchar = NULL;
+         }
+       else
+         {
+           /* This is an option that requires an argument.  */
+           if (*nextchar != '\0')
+             {
+               optarg = nextchar;
+               /* If we end this ARGV-element by taking the rest as an arg,
+                  we must advance to the next element now.  */
+               optind++;
+             }
+           else if (optind == argc)
+             {
+               if (print_errors)
+                 {
+                   /* 1003.2 specifies the format of this message.  */
+#if defined _LIBC && defined USE_IN_LIBIO
+                   char *buf;
+
+                   if (__asprintf (&buf, _("\
+%s: option requires an argument -- %c\n"),
+                                   argv[0], c) >= 0)
+                     {
+                       if (_IO_fwide (stderr, 0) > 0)
+                         __fwprintf (stderr, L"%s", buf);
+                       else
+                         fputs (buf, stderr);
+
+                       free (buf);
+                     }
+#else
+                   fprintf (stderr,
+                            _("%s: option requires an argument -- %c\n"),
+                            argv[0], c);
+#endif
+                 }
+               optopt = c;
+               if (optstring[0] == ':')
+                 c = ':';
+               else
+                 c = '?';
+             }
+           else
+             /* We already incremented `optind' once;
+                increment it again when taking next ARGV-elt as argument.  */
+             optarg = argv[optind++];
+           nextchar = NULL;
+         }
+      }
+    return c;
+  }
+}
+
+int
+getopt (argc, argv, optstring)
+     int argc;
+     char *const *argv;
+     const char *optstring;
+{
+  return _getopt_internal (argc, argv, optstring,
+                          (const struct option *) 0,
+                          (int *) 0,
+                          0);
+}
+
+#endif /* Not ELIDE_CODE.  */
+\f
+#ifdef TEST
+
+/* Compile with -DTEST to make an executable for use in testing
+   the above definition of `getopt'.  */
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+
+      c = getopt (argc, argv, "abc:d:0123456789");
+      if (c == -1)
+       break;
+
+      switch (c)
+       {
+       case '0':
+       case '1':
+       case '2':
+       case '3':
+       case '4':
+       case '5':
+       case '6':
+       case '7':
+       case '8':
+       case '9':
+         if (digit_optind != 0 && digit_optind != this_option_optind)
+           printf ("digits occur in two different argv-elements.\n");
+         digit_optind = this_option_optind;
+         printf ("option %c\n", c);
+         break;
+
+       case 'a':
+         printf ("option a\n");
+         break;
+
+       case 'b':
+         printf ("option b\n");
+         break;
+
+       case 'c':
+         printf ("option c with value `%s'\n", optarg);
+         break;
+
+       case '?':
+         break;
+
+       default:
+         printf ("?? getopt returned character code 0%o ??\n", c);
+       }
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+       printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
diff --git a/posix/getopt.h b/posix/getopt.h
new file mode 100644 (file)
index 0000000..4283c35
--- /dev/null
@@ -0,0 +1,181 @@
+/* Declarations for getopt.
+   Copyright (C) 1989-1994, 1996-1999, 2001 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+
+#ifndef _GETOPT_H
+
+#ifndef __need_getopt
+# define _GETOPT_H 1
+#endif
+
+/* If __GNU_LIBRARY__ is not already defined, either we are being used
+   standalone, or this is the first header included in the source file.
+   If we are being used with glibc, we need to include <features.h>, but
+   that does not exist if we are standalone.  So: if __GNU_LIBRARY__ is
+   not defined, include <ctype.h>, which will pull in <features.h> for us
+   if it's from glibc.  (Why ctype.h?  It's guaranteed to exist and it
+   doesn't flood the namespace with stuff the way some other headers do.)  */
+#if !defined __GNU_LIBRARY__
+# include <ctype.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/* For communication from `getopt' to the caller.
+   When `getopt' finds an option that takes an argument,
+   the argument value is returned here.
+   Also, when `ordering' is RETURN_IN_ORDER,
+   each non-option ARGV-element is returned here.  */
+
+extern char *optarg;
+
+/* Index in ARGV of the next element to be scanned.
+   This is used for communication to and from the caller
+   and for communication between successive calls to `getopt'.
+
+   On entry to `getopt', zero means this is the first call; initialize.
+
+   When `getopt' returns -1, this is the index of the first of the
+   non-option elements that the caller should itself scan.
+
+   Otherwise, `optind' communicates from one call to the next
+   how much of ARGV has been scanned so far.  */
+
+extern int optind;
+
+/* Callers store zero here to inhibit the error message `getopt' prints
+   for unrecognized options.  */
+
+extern int opterr;
+
+/* Set to an option character which was unrecognized.  */
+
+extern int optopt;
+
+#ifndef __need_getopt
+/* Describe the long-named options requested by the application.
+   The LONG_OPTIONS argument to getopt_long or getopt_long_only is a vector
+   of `struct option' terminated by an element containing a name which is
+   zero.
+
+   The field `has_arg' is:
+   no_argument         (or 0) if the option does not take an argument,
+   required_argument   (or 1) if the option requires an argument,
+   optional_argument   (or 2) if the option takes an optional argument.
+
+   If the field `flag' is not NULL, it points to a variable that is set
+   to the value given in the field `val' when the option is found, but
+   left unchanged if the option is not found.
+
+   To have a long-named option do something other than set an `int' to
+   a compiled-in constant, such as set a value from `optarg', set the
+   option's `flag' field to zero and its `val' field to a nonzero
+   value (the equivalent single-letter option character, if there is
+   one).  For long options that have a zero `flag' field, `getopt'
+   returns the contents of the `val' field.  */
+
+struct option
+{
+# if (defined __STDC__ && __STDC__) || defined __cplusplus
+  const char *name;
+# else
+  char *name;
+# endif
+  /* has_arg can't be an enum because some compilers complain about
+     type mismatches in all the code that assumes it is an int.  */
+  int has_arg;
+  int *flag;
+  int val;
+};
+
+/* Names for the values of the `has_arg' field of `struct option'.  */
+
+# define no_argument           0
+# define required_argument     1
+# define optional_argument     2
+#endif /* need getopt */
+
+
+/* Get definitions and prototypes for functions to process the
+   arguments in ARGV (ARGC of them, minus the program name) for
+   options given in OPTS.
+
+   Return the option character from OPTS just read.  Return -1 when
+   there are no more options.  For unrecognized options, or options
+   missing arguments, `optopt' is set to the option letter, and '?' is
+   returned.
+
+   The OPTS string is a list of characters which are recognized option
+   letters, optionally followed by colons, specifying that that letter
+   takes an argument, to be placed in `optarg'.
+
+   If a letter in OPTS is followed by two colons, its argument is
+   optional.  This behavior is specific to the GNU `getopt'.
+
+   The argument `--' causes premature termination of argument
+   scanning, explicitly telling `getopt' that there are no more
+   options.
+
+   If OPTS begins with `--', then non-option arguments are treated as
+   arguments to the option '\0'.  This behavior is specific to the GNU
+   `getopt'.  */
+
+#if (defined __STDC__ && __STDC__) || defined __cplusplus
+# ifdef __GNU_LIBRARY__
+/* Many other libraries have conflicting prototypes for getopt, with
+   differences in the consts, in stdlib.h.  To avoid compilation
+   errors, only prototype getopt for the GNU C library.  */
+extern int getopt (int ___argc, char *const *___argv, const char *__shortopts);
+# else /* not __GNU_LIBRARY__ */
+extern int getopt ();
+# endif /* __GNU_LIBRARY__ */
+
+# ifndef __need_getopt
+extern int getopt_long (int ___argc, char *const *___argv,
+                       const char *__shortopts,
+                       const struct option *__longopts, int *__longind);
+extern int getopt_long_only (int ___argc, char *const *___argv,
+                            const char *__shortopts,
+                            const struct option *__longopts, int *__longind);
+
+/* Internal only.  Users should not call this directly.  */
+extern int _getopt_internal (int ___argc, char *const *___argv,
+                            const char *__shortopts,
+                            const struct option *__longopts, int *__longind,
+                            int __long_only);
+# endif
+#else /* not __STDC__ */
+extern int getopt ();
+# ifndef __need_getopt
+extern int getopt_long ();
+extern int getopt_long_only ();
+
+extern int _getopt_internal ();
+# endif
+#endif /* __STDC__ */
+
+#ifdef __cplusplus
+}
+#endif
+
+/* Make sure we later can get all the definitions and declarations.  */
+#undef __need_getopt
+
+#endif /* getopt.h */
diff --git a/posix/getopt1.c b/posix/getopt1.c
new file mode 100644 (file)
index 0000000..ad06cc7
--- /dev/null
@@ -0,0 +1,196 @@
+/* getopt_long and getopt_long_only entry points for GNU getopt.
+   Copyright (C) 1987,88,89,90,91,92,93,94,96,97,98
+     Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, write to the Free
+   Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+   02111-1307 USA.  */
+\f
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef _LIBC
+# include <getopt.h>
+#else
+# include "getopt.h"
+#endif
+
+#if !defined __STDC__ || !__STDC__
+/* This is a separate conditional since some stdc systems
+   reject `defined (const)'.  */
+#ifndef const
+#define const
+#endif
+#endif
+
+#include <stdio.h>
+
+/* Comment out all this code if we are using the GNU C Library, and are not
+   actually compiling the library itself.  This code is part of the GNU C
+   Library, but also included in many other GNU distributions.  Compiling
+   and linking in this code is a waste when using the GNU C library
+   (especially if it is a shared library).  Rather than having every GNU
+   program understand `configure --with-gnu-libc' and omit the object files,
+   it is simpler to just do this in the source for each such file.  */
+
+#define GETOPT_INTERFACE_VERSION 2
+#if !defined _LIBC && defined __GLIBC__ && __GLIBC__ >= 2
+#include <gnu-versions.h>
+#if _GNU_GETOPT_INTERFACE_VERSION == GETOPT_INTERFACE_VERSION
+#define ELIDE_CODE
+#endif
+#endif
+
+#ifndef ELIDE_CODE
+
+
+/* This needs to come after some library #include
+   to get __GNU_LIBRARY__ defined.  */
+#ifdef __GNU_LIBRARY__
+#include <stdlib.h>
+#endif
+
+#ifndef        NULL
+#define NULL 0
+#endif
+
+int
+getopt_long (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 0);
+}
+
+/* Like getopt_long, but '-' as well as '--' can indicate a long option.
+   If an option that starts with '-' (not '--') doesn't match a long option,
+   but does match a short option, it is parsed as a short option
+   instead.  */
+
+int
+getopt_long_only (argc, argv, options, long_options, opt_index)
+     int argc;
+     char *const *argv;
+     const char *options;
+     const struct option *long_options;
+     int *opt_index;
+{
+  return _getopt_internal (argc, argv, options, long_options, opt_index, 1);
+}
+
+# ifdef _LIBC
+libc_hidden_def (getopt_long)
+libc_hidden_def (getopt_long_only)
+# endif
+
+#endif /* Not ELIDE_CODE.  */
+\f
+#ifdef TEST
+
+#include <stdio.h>
+
+int
+main (argc, argv)
+     int argc;
+     char **argv;
+{
+  int c;
+  int digit_optind = 0;
+
+  while (1)
+    {
+      int this_option_optind = optind ? optind : 1;
+      int option_index = 0;
+      static struct option long_options[] =
+      {
+       {"add", 1, 0, 0},
+       {"append", 0, 0, 0},
+       {"delete", 1, 0, 0},
+       {"verbose", 0, 0, 0},
+       {"create", 0, 0, 0},
+       {"file", 1, 0, 0},
+       {0, 0, 0, 0}
+      };
+
+      c = getopt_long (argc, argv, "abc:d:0123456789",
+                      long_options, &option_index);
+      if (c == -1)
+       break;
+
+      switch (c)
+       {
+       case 0:
+         printf ("option %s", long_options[option_index].name);
+         if (optarg)
+           printf (" with arg %s", optarg);
+         printf ("\n");
+         break;
+
+       case '0':
+       case '1':
+       case '2':
+       case '3':
+       case '4':
+       case '5':
+       case '6':
+       case '7':
+       case '8':
+       case '9':
+         if (digit_optind != 0 && digit_optind != this_option_optind)
+           printf ("digits occur in two different argv-elements.\n");
+         digit_optind = this_option_optind;
+         printf ("option %c\n", c);
+         break;
+
+       case 'a':
+         printf ("option a\n");
+         break;
+
+       case 'b':
+         printf ("option b\n");
+         break;
+
+       case 'c':
+         printf ("option c with value `%s'\n", optarg);
+         break;
+
+       case 'd':
+         printf ("option d with value `%s'\n", optarg);
+         break;
+
+       case '?':
+         break;
+
+       default:
+         printf ("?? getopt returned character code 0%o ??\n", c);
+       }
+    }
+
+  if (optind < argc)
+    {
+      printf ("non-option ARGV-elements: ");
+      while (optind < argc)
+       printf ("%s ", argv[optind++]);
+      printf ("\n");
+    }
+
+  exit (0);
+}
+
+#endif /* TEST */
index 8c4db04970e8d5d7946285cbf50f42b5739cc1f7..9af2012ef68fe00c8fe08da8df6fd69451079cf7 100644 (file)
@@ -47,7 +47,7 @@
 #include "scsicmds.h"
 #include "utility.h"
 
-const char *scsicmds_c_cvsid="$Id: scsicmds.cpp,v 1.92 2006/11/12 04:45:54 dpgilbert Exp $"
+const char *scsicmds_c_cvsid="$Id: scsicmds.cpp,v 1.94 2007/03/23 03:47:28 dpgilbert Exp $"
 CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSICMDS_H_CVSID UTILITY_H_CVSID;
 
 /* for passing global control variables */
@@ -116,8 +116,8 @@ static struct scsi_opcode_name opcode_name_arr[] = {
     {TEST_UNIT_READY, "test unit ready"},       /* 0x00 */
     {REQUEST_SENSE, "request sense"},           /* 0x03 */
     {INQUIRY, "inquiry"},                       /* 0x12 */
-    {MODE_SELECT, "mode select"},               /* 0x15 */
-    {MODE_SENSE, "mode sense"},                 /* 0x1a */
+    {MODE_SELECT, "mode select(6)"},            /* 0x15 */
+    {MODE_SENSE, "mode sense(6)"},              /* 0x1a */
     {RECEIVE_DIAGNOSTIC, "receive diagnostic"}, /* 0x1c */
     {SEND_DIAGNOSTIC, "send diagnostic"},       /* 0x1d */
     {READ_DEFECT_10, "read defect list(10)"},   /* 0x37 */
@@ -171,6 +171,9 @@ void scsi_do_sense_disect(const struct scsi_cmnd_io * io_buf,
 int scsiSimpleSenseFilter(const struct scsi_sense_disect * sinfo)
 {
     switch (sinfo->sense_key) {
+    case SCSI_SK_NO_SENSE:
+    case SCSI_SK_RECOVERED_ERR:
+        return SIMPLE_NO_ERROR;
     case SCSI_SK_NOT_READY:
         if (SCSI_ASC_NO_MEDIUM == sinfo->asc) 
             return SIMPLE_ERR_NO_MEDIUM;
@@ -195,8 +198,10 @@ int scsiSimpleSenseFilter(const struct scsi_sense_disect * sinfo)
             return SIMPLE_ERR_BAD_PARAM;    /* all other illegal request */
     case SCSI_SK_UNIT_ATTENTION:
         return SIMPLE_ERR_TRY_AGAIN;
+    case SCSI_SK_ABORTED_COMMAND:
+        return SIMPLE_ERR_ABORTED_COMMAND;
     default:
-        return SIMPLE_NO_ERROR;
+        return SIMPLE_ERR_UNKNOWN;
     }
 }
 
@@ -225,6 +230,10 @@ const char * scsiErrString(int scsiErr)
             return "unit attention reported, try again";
         case SIMPLE_ERR_MEDIUM_HARDWARE: 
             return "medium or hardware error (serious)";
+        case SIMPLE_ERR_UNKNOWN: 
+            return "unknown error (unexpected sense key)";
+        case SIMPLE_ERR_ABORTED_COMMAND: 
+            return "aborted command (transport problem?)";
         default:
             return "unknown error";
     }
@@ -290,6 +299,8 @@ int scsiLogSense(int device, int pagenum, int subpagenum, UINT8 *pBuf,
         if (0 == ((pBuf[2] << 8) + pBuf[3]))
             return SIMPLE_ERR_BAD_RESP;
         pageLen = (pBuf[2] << 8) + pBuf[3] + 4;
+        if (4 == pageLen)  /* why define a lpage with no payload? */
+            pageLen = 252; /* some IBM tape drives don't like double fetch */
         /* some SCSI HBA don't like "odd" length transfers */
         if (pageLen % 2)
             pageLen += 1;   
index 939be2849e6b4cf71aad02f0faa05415e88a80a7..347134b8bbb1db15499370d04cd410797ae09874 100644 (file)
@@ -32,7 +32,7 @@
 #ifndef SCSICMDS_H_
 #define SCSICMDS_H_
 
-#define SCSICMDS_H_CVSID "$Id: scsicmds.h,v 1.63 2006/11/12 04:46:32 dpgilbert Exp $\n"
+#define SCSICMDS_H_CVSID "$Id: scsicmds.h,v 1.65 2007/03/23 03:45:34 dpgilbert Exp $\n"
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -85,7 +85,7 @@
 #endif
 
 typedef unsigned char UINT8;
-typedef char INT8;
+typedef signed char INT8;
 typedef unsigned int UINT32;
 typedef int INT32;
 
@@ -230,6 +230,7 @@ Documentation, see http://www.storage.ibm.com/techsup/hddtech/prodspecs.htm */
 #define SCSI_SK_HARDWARE_ERROR          0x4
 #define SCSI_SK_ILLEGAL_REQUEST         0x5
 #define SCSI_SK_UNIT_ATTENTION          0x6
+#define SCSI_SK_ABORTED_COMMAND         0xb
 
 /* defines for useful Additional Sense Codes (ASCs) */
 #define SCSI_ASC_NOT_READY              0x4     /* more info in ASCQ code */
@@ -253,6 +254,8 @@ Documentation, see http://www.storage.ibm.com/techsup/hddtech/prodspecs.htm */
 #define SIMPLE_ERR_BECOMING_READY       7       /* device will be ready soon */
 #define SIMPLE_ERR_TRY_AGAIN            8       /* some warning, try again */
 #define SIMPLE_ERR_MEDIUM_HARDWARE      9       /* medium or hardware error */
+#define SIMPLE_ERR_UNKNOWN              10      /* unknown sense value */
+#define SIMPLE_ERR_ABORTED_COMMAND      11      /* most likely transport error */
 
 
 /* defines for functioncode parameter in SENDDIAGNOSTIC function */
index 4f7c5b372e8a5763b297ff9b2e9b220e856d9c89..6423ee7ebf2298ef249b9d1ecf74f5347bcb4e00 100644 (file)
@@ -3,11 +3,11 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
  * Additional SCSI work:
- * Copyright (C) 2003-6 Douglas Gilbert <dougg@torque.net>
+ * Copyright (C) 2003-7 Douglas Gilbert <dougg@torque.net>
  *
  * 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
@@ -42,7 +42,7 @@
 
 #define GBUF_SIZE 65535
 
-const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.119 2006/11/12 04:47:23 dpgilbert Exp $"
+const char* scsiprint_c_cvsid="$Id: scsiprint.cpp,v 1.120 2007/07/21 20:59:41 chrfranke Exp $"
 CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // control block which points to external global control variables
@@ -1069,20 +1069,22 @@ static int scsiGetDriveInfo(int device, UINT8 * peripheral_type, int all)
     } else
         modese_len = iec.modese_len;
 
-    if (0 == (err = scsiInquiryVpd(device, 0x80, gBuf, 64))) {
-        /* should use VPD page 0x83 and fall back to this page (0x80)
-         * if 0x83 not supported. NAA requires a lot of decoding code */
-        len = gBuf[3];
-        gBuf[4 + len] = '\0';
-        pout("Serial number: %s\n", &gBuf[4]);
-    }
-    else if (con->reportscsiioctl > 0) {
-        PRINT_ON(con);
-        if (SIMPLE_ERR_BAD_RESP == err)
-            pout("Vital Product Data (VPD) bit ignored in INQUIRY\n");
-        else
-            pout("Vital Product Data (VPD) INQUIRY failed [%d]\n", err);
-        PRINT_OFF(con);
+    if (!con->dont_print_serial) {
+        if (0 == (err = scsiInquiryVpd(device, 0x80, gBuf, 64))) {
+            /* should use VPD page 0x83 and fall back to this page (0x80)
+             * if 0x83 not supported. NAA requires a lot of decoding code */
+            len = gBuf[3];
+            gBuf[4 + len] = '\0';
+            pout("Serial number: %s\n", &gBuf[4]);
+        }
+        else if (con->reportscsiioctl > 0) {
+            PRINT_ON(con);
+            if (SIMPLE_ERR_BAD_RESP == err)
+                pout("Vital Product Data (VPD) bit ignored in INQUIRY\n");
+            else
+                pout("Vital Product Data (VPD) INQUIRY failed [%d]\n", err);
+            PRINT_OFF(con);
+        }
     }
 
     // print SCSI peripheral device type
index f475d7ef62a6130ca66f171078f348396dc55336..61e7d1c0f9359e4513a3ca85c9000daff7c9b4f8 100644 (file)
@@ -1,7 +1,7 @@
 .ig
- Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
- $Id: smartctl.8.in,v 1.90 2006/12/20 07:30:43 sxzzsf Exp $
+ $Id: smartctl.8.in,v 1.103 2007/09/06 08:48:55 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
@@ -82,34 +82,44 @@ your architecture.
 .IP \fBSOLARIS\fP: 9
 Use the forms \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
 devices, and \fB"/dev/rmt/*"\fP for SCSI tape devices.
-.IP \fBWINDOWS\fP: 9
-Use the form \fB"/dev/hd[a\-j]"\fP for IDE/ATA
-devices "\\\\.\\PhysicalDrive[0\-9]" on WinNT4/2000/XP/2003. For IDE/ATA
-devices on Win95/98/98SE/ME, use \fB"/dev/hd[a\-d]"\fP for standard devices
+.IP \fBWINDOWS\ 9x/ME\fP: 9
+Use the forms \fB"/dev/hd[a\-d]"\fP for standard IDE/ATA devices
 accessed via SMARTVSD.VXD, and \fB"/dev/hd[e\-h]"\fP for additional devices
 accessed via a patched SMARTVSE.VXD (see INSTALL file for details).
 Use the form \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices via an aspi dll
-on ASPI adapter 0\-9, ID 0\-15. Alternatively use \fB"/dev/sd[a\-z]"\fP for
-SCSI disks "\\\\.\\PhysicalDrive[0\-25]" on WinNT4/2000/XP/2003 (where "a"
-maps to "0"). SCSI disks can also be referred to as \fB"/dev/pd[0\-255]"\fP
-for "\\\\.\\PhysicalDrive[0\-255]" on WinNT4/2000/XP/2003. Use the
-form \fB"/dev/tape[0\-255]"\fP for SCSI tape drives "\\\\.\\Tape[0\-255]"
-on WinNT4/2000/XP/2003.
-For disks behind 3ware 9000 controllers use \fB"/dev/hd[a\-j],N"\fP where
+on ASPI adapter 0\-9, ID 0\-15. The prefix \fB"/dev/"\fP is optional.
+.IP \fBWINDOWS\ NT4/2000/XP/2003/Vista\fP: 9
+Use the forms \fB"/dev/sd[a\-z]"\fP for IDE/(S)ATA and SCSI disks
+"\\\\.\\PhysicalDrive[0\-25]" (where "a" maps to "0").
+These disks can also be referred to as \fB"/dev/pd[0\-255]"\fP for
+"\\\\.\\PhysicalDrive[0\-255]".
+ATA disks can also be referred to as \fB"/dev/hd[a\-z]"\fP for
+"\\\\.\\PhysicalDrive[0\-25]". 
+Use one the forms \fB"/dev/tape[0\-255]"\fP, \fB"/dev/st[0\-255]"\fP,
+or \fB"/dev/nst[0\-255]"\fP for SCSI tape drives "\\\\.\\Tape[0\-255]".
+
+Alternatively, drive letters \fB"X:"\fP or \fB"X:\\"\fP may be used to
+specify the physical drive behind a mounted partition.
+
+For disks behind 3ware 9000 controllers use \fB"/dev/sd[a\-z],N"\fP where
 N specifies the disk number (3ware \'port\') behind the controller
-providing the logical drive (\'unit\') specified by \fB"/dev/hd[a\-j]"\fP.
+providing the logical drive (\'unit\') specified by \fB"/dev/sd[a\-z]"\fP.
 Alternatively, use \fB"/dev/tw_cli/cx/py"\fP for controller x, port y
 to run the \'tw_cli\' tool and parse the output. This provides limited
-monitoring (\'-i\', \'-c\', \'-A\' below) if SMART support is missing
+monitoring (\'\-i\', \'\-c\', \'\-A\' below) if SMART support is missing
 in the driver. Use \fB"/dev/tw_cli/stdin"\fP or \fB"/dev/tw_cli/clip"\fP
 to parse CLI or 3DM output from standard input or clipboard.
-The option \'-d 3ware,N\' is not necessary on Windows.
+The option \'\-d 3ware,N\' is not necessary on Windows.
 The prefix \fB"/dev/"\fP is optional.
 .IP \fBCYGWIN\fP: 9
-See "WINDOWS" above.
+See "WINDOWS NT4/2000/XP/2003/Vista" above.
 .IP \fBOS/2,eComStation\fP: 9
 Use the form \fB"/dev/hd[a\-z]"\fP for IDE/ATA devices.
 .PP
+if \'\-\' is specified as the device path, \fBsmartctl\fP reads and
+interprets it's own debug output from standard input.
+See \'\-r ataioctl\' below for details.
+.PP
 Based on the device path, \fBsmartctl\fP will guess the device type
 (ATA or SCSI).  If necessary, the \'\-d\' option can be used to over\-ride
 this guess
@@ -165,7 +175,7 @@ Prints all SMART information about the disk, or TapeAlert information
 about the tape drive or changer.  For ATA devices this is equivalent
 to
 .nf
-\'\-H \-i \-c \-A \-l error \-l selftest -l selective\'
+\'\-H \-i \-c \-A \-l error \-l selftest \-l selective\'
 .fi
 and for SCSI, this is equivalent to
 .nf
@@ -193,6 +203,10 @@ which failed either now or in the past.
 .I silent
 \- print no output.  The only way to learn about what was found is to
 use the exit status of \fBsmartctl\fP (see RETURN VALUES below).
+
+.I noserial
+\- Do not print the serial number of the device.
+
 .TP
 .B \-d TYPE, \-\-device=TYPE
 Specifies the type of the device.  The valid arguments to this option
@@ -210,7 +224,7 @@ overridden with either \'\-d sat,12\' or \'\-d sat,16\'.
 Under Linux, to look at SATA disks behind Marvell SATA controllers
 (using Marvell's \'linuxIAL\' driver rather than libata driver) use \'\-d marvell\'. Such
 controllers show up as Marvell Technology Group Ltd. SATA I or II controllers
-using lspci, or using lspci -n show a vendor ID 0x11ab and a device ID of
+using lspci, or using lspci \-n show a vendor ID 0x11ab and a device ID of
 either 0x5040, 0x5041, 0x5080, 0x5081, 0x6041 or 0x6081. The \'linuxIAL\' driver
 seems not (yet?) available in the Linux kernel source tree, but should be available
 from system vendors (ftp://ftp.aslab.com/ is known to provide a patch with the driver).
@@ -228,21 +242,21 @@ use syntax such as:
 .fi
 where in the argument \fI3ware,N\fP, the integer N is the disk number
 (3ware \'port\') within the 3ware ATA RAID controller.  The allowed
-values of N are from 0 to 15 inclusive.  The first two forms, which
-refer to devices /dev/sda-z and /dev/twe0-15, may be used with 3ware
-series 6000, 7000, and 8000 series controllers that use the 3x-xxxx
-driver.  \fBNote that the /dev/sda-z form is deprecated\fP starting
+values of N are from 0 to 31 inclusive.  The first two forms, which
+refer to devices /dev/sda\-z and /dev/twe0\-15, may be used with 3ware
+series 6000, 7000, and 8000 series controllers that use the 3x\-xxxx
+driver.  \fBNote that the /dev/sda\-z form is deprecated\fP starting
 with the Linux 2.6 kernel series and may not be supported by the Linux
 kernel in the near future. The final form, which refers to devices
-/dev/twa0-15, must be used with 3ware 9000 series controllers, which
-use the 3w-9xxx driver.
+/dev/twa0\-15, must be used with 3ware 9000 series controllers, which
+use the 3w\-9xxx driver.
 
 Note that if the special character device nodes /dev/twa? and
 /dev/twe? do not exist, or exist with the incorrect major or minor
 numbers, smartctl will recreate them on the fly.  Typically /dev/twa0
-refers to the first 9000-series controller, /dev/twa1 refers to the
+refers to the first 9000\-series controller, /dev/twa1 refers to the
 second 9000 series controller, and so on. Likewise /dev/twe0 refers to
-the first 6/7/8000-series controller, /dev/twa1 refers to the second
+the first 6/7/8000\-series controller, /dev/twa1 refers to the second
 6/7/8000 series controller, and so on.
 
 Note that for the 6/7/8000 controllers, \fBany\fP of the physical
@@ -274,7 +288,7 @@ messages instead: "\fB3w\-xxxx: tw_ioctl(): Passthru size (123392) too
 big\fP". This can be fixed by upgrading to version 1.02.00.037 or
 later of the 3w\-xxxx driver, or by applying a patch to older
 versions. See \fBhttp://smartmontools.sourceforge.net/\fP for
-instructions.  Alternatively, use the character device /dev/twe0-15 interface.
+instructions.  Alternatively, use the character device /dev/twe0\-15 interface.
 
 The selective self\-test functions (\'\-t select,A\-B\') are only supported
 using the character device interface /dev/twa0\-15 and /dev/twe0\-15.
@@ -296,7 +310,7 @@ where in the argument \fIhpt,L/M\fP or \fIhpt,L/M/N\fP, the integer L is the
 controller id, the integer M is the channel number, and the integer N is the
 PMPort number if it is available. The allowed values of L are from 1 to 4
 inclusive, M are from 1 to 8 inclusive and N from 1 to 4 if PMPort available.
-Note that the /dev/sda-z form should be the device node which stands for
+Note that the /dev/sda\-z form should be the device node which stands for
 the disks derived from the HighPoint RocketRAID controllers.  And also
 these values are limited by the model of the HighPoint RocketRAID controller.
 
@@ -394,6 +408,13 @@ the integer with no spaces.  For example,
 The default
 level is 1, so \'\-r ataioctl,1\' and \'\-r ataioctl\' are equivalent.
 
+For testing purposes, the output of \'\-r ataioctl,2\' can later be parsed
+by \fBsmartctl\fP itself if \'\-\' is used as device path argument.
+The ATA command input parameters, sector data and return values are
+reconstructed from the debug report read from stdin.
+Then \fBsmartctl\fP internally simulates an ATA device with the same
+behaviour. This is does not work for SCSI devices yet.
+
 .TP
 .B \-n POWERMODE, \-\-nocheck=POWERMODE
 Specifieds if \fBsmartctl\fP should exit before performing any checks
@@ -647,7 +668,7 @@ ATA/ATAPI\-5 disks seem to respect their meaning, so we have retained
 the option of printing the Attribute values.
 
 For SCSI devices the "attributes" are obtained from the temperature
-and start-stop cycle counter log pages. Certain vendor specific
+and start\-stop cycle counter log pages. Certain vendor specific
 attributes are listed if recognised. The attributes are output in a
 relatively free format (compared with ATA disk attributes).
 .TP
@@ -816,6 +837,19 @@ typically be either recovered or unrecoverable errors. That latter group
 may need some attention. There is a description of the background scan
 mechansim in section 4.18 of SBC\-3 revision 6 (see www.t10.org ).
 
+.I scttemp, scttempsts, scttemphist [ATA]
+\- [NEW EXPERIMENTAL SMARTCTL FEATURE] prints the disk temperature
+information provided by the SMART Command Transport (SCT) commands.
+The option \'scttempsts\' prints current temperature and temperature
+ranges returned by the SCT Status command, \'scttemphist\' prints
+temperature limits and the temperature history table returned by
+the SCT Data Table command, and \'scttemp\' prints both.
+The temperature values are preserved across power cycles.
+The default temperature logging interval is 1 minute and can be
+configured with the \'\-t scttempint,N[,p]\' option, see below.
+The SCT commands are specified in the proposed ATA\-8 Command Set
+(ACS), and are already implemented in some recent ATA\-7 disks.
+
 .TP
 .B \-v N,OPTION, \-\-vendorattribute=N,OPTION
 Sets a vendor\-specific display OPTION for Attribute N.  This option
@@ -910,9 +944,9 @@ value for Attribute 123 in this form.
 .TP
 .B \-F TYPE, \-\-firmwarebug=TYPE
 Modifies the behavior of \fBsmartctl\fP to compensate for some known
-and understood device firmware bug.  The arguments to this option are
-exclusive, so that only the final option given is used.  The valid
-values are:
+and understood device firmware or driver bug.  Except \'swapid\',
+the arguments to this option are exclusive, so that only the final
+option given is used.  The valid values are:
 
 .I none
 \- Assume that the device firmware obeys the ATA specifications.  This
@@ -934,15 +968,25 @@ are (1) no self\-test log printed, even though you have run self\-tests;
 the number of ATA errors reported is byte swapped.  Enabling this
 option tells \fBsmartctl\fP to evaluate this quantity in
 byte\-reversed order. An indication that your Samsung disk needs this
-option is that the self-test log is printed correctly, but there are a
+option is that the self\-test log is printed correctly, but there are a
 very large number of errors in the SMART error log.  This is because
 the error count is byte swapped.  Thus a disk with five errors
 (0x0005) will appear to have 20480 errors (0x5000).
 
+.I samsung3
+\- Some Samsung disks (at least SP2514N with Firmware VF100\-37) report
+a self\-test still in progress with 0% remaining when the test was already
+completed. Enabling this option modifies the output of the self\-test
+execution status (see options \'\-c\' or \'\-a\' above) accordingly.
+
 Note that an explicit \'\-F\' option on the command line will
 over\-ride any preset values for \'\-F\' (see the \'\-P\' option
 below).
 
+.I swapid
+\- Fixes byte swapped ATA identify strings (device name, serial number,
+firmware version) returned by some buggy device drivers.
+
 .TP
 .B \-P TYPE, \-\-presets=TYPE
 Specifies whether \fBsmartctl\fP should use any preset options that
@@ -1068,18 +1112,27 @@ order of minutes to complete.  Note that this command can be given
 during normal system operation (unless run in captive mode \- see the
 \'\-C\' option below).
 
-.I select,N\-M
-\- [ATA ONLY] [NEW EXPERIMENTAL SMARTCTL FEATURE] runs a SMART
+.I select,N\-M, select,N+SIZE
+\- [ATA ONLY] [EXPERIMENTAL SMARTCTL FEATURE] runs a SMART
 Selective Self Test, to test a \fBrange\fP of disk Logical Block
 Addresses (LBAs), rather than the entire disk.  Each range of LBAs
 that is checked is called a "span" and is specified by a starting LBA
-(N) and an ending LBA (M) with N less than or equal to M.  For example
-the command:
+(N) and an ending LBA (M) with N less than or equal to M. The range
+can also be specified as N+SIZE. A span at the end of a disk can
+be specified by N\-\fBmax\fP.
+
+For example the commands:
 .nf
   smartctl \-t select,10\-20 /dev/hda
+  smartctl \-t select,10+11 /dev/hda
 .fi
-runs a self test on one span consisting of LBAs ten to twenty
-(inclusive). The \'\-t\' option can be given up to five times, to test
+both runs a self test on one span consisting of LBAs ten to twenty
+(inclusive). The command:
+.nf
+  smartctl \-t select,100000000\-max /dev/hda
+.fi
+run a self test from LBA 100000000 up to the end of the disk.
+The \'\-t\' option can be given up to five times, to test
 up to five spans.  For example the command:
 .nf
   smartctl \-t select,0\-100 \-t select,1000\-2000 /dev/hda
@@ -1104,11 +1157,60 @@ Logical Block Addresses (LBAs).
 Selective self\-tests can be run during normal system operation (unless
 done in captive mode \- see the \'\-C\' option below).
 
-[Note: this new experimental smartmontools feature is currently only
-available under Linux.  The Linux kernel must be compiled with the
-configuration option CONFIG_IDE_TASKFILE_IO enabled.  Please report
-unusual or incorrect behavior to the smartmontools\-support mailing
-list.]
+[Note: To use this feature on Linux, the kernel must be compiled with
+the configuration option CONFIG_IDE_TASKFILE_IO enabled.  Please report
+unusual or incorrect behavior to the smartmontools\-support mailing list.]
+
+The following variants of the selective self\-test command use spans based
+on the ranges from past tests already stored on the disk:
+
+.I select,redo[+SIZE]
+\- [ATA ONLY] [NEW EXPERIMENTAL SMARTCTL FEATURE] redo the last SMART
+Selective Self Test using the same LBA range. The starting LBA is identical
+to the LBA used by last test, same for ending LBA unless a new span size
+is specified by optional +SIZE argument.
+
+For example the commands:
+.nf
+  smartctl \-t select,10\-20 /dev/hda
+  smartctl \-t select,redo /dev/hda
+  smartctl \-t select,redo+20 /dev/hda
+.fi
+have the same effect as:
+.nf
+  smartctl \-t select,10\-20 /dev/hda
+  smartctl \-t select,10\-20 /dev/hda
+  smartctl \-t select,10\-29 /dev/hda
+.fi
+
+.I select,next[+SIZE]
+\- [ATA ONLY] [NEW EXPERIMENTAL SMARTCTL FEATURE] runs a SMART Selective
+Self Test on the LBA range which follows the range of the last test. The
+starting LBA is set to (ending LBA +1) of the last test. A new span size
+may be specified by the optional +SIZE argument.
+
+For example the commands:
+.nf
+  smartctl \-t select,0\-999 /dev/hda
+  smartctl \-t select,next /dev/hda
+  smartctl \-t select,next+2000 /dev/hda
+.fi
+have the same effect as:
+.nf
+  smartctl \-t select,0\-999 /dev/hda
+  smartctl \-t select,1000\-1999 /dev/hda
+  smartctl \-t select,2000\-3999 /dev/hda
+.fi
+
+If the last test ended at the last LBA of the disk, the new range starts
+at LBA 0. The span size of the last span of a disk is adjusted such that
+the total number of spans to check the full disk will not be changed
+by future uses of \'\-t select,next\'.
+
+.I select,cont[+SIZE]
+\- [ATA ONLY] [NEW EXPERIMENTAL SMARTCTL FEATURE] performs a \'redo\'
+(above) if the self test status reports that the last test was aborted
+by the host. Otherwise it run the \'next\' (above) test.
 
 .I afterselect,on
 \- [ATA ONLY] perform an offline read scan after a Selective Self\-test
@@ -1136,6 +1238,15 @@ option must be use together with one or more of the \fIselect,N\-M\fP
 options above. The value of this option is preserved between selective
 self\-tests.
 
+.I scttempint,N[,p]
+\- [ATA ONLY] [NEW EXPERIMENTAL SMARTCTL FEATURE] set the time interval
+for SCT temperature logging to N minutes. If \',p\' is specified, the
+setting is preserved across power cycles. Otherwise, the setting is
+volatile and will be reverted to default (1 minute), or last
+non-volatile setting by the next hard reset. This command also clears
+the temperature history table. See \'\-l scttemp\' above for more
+information about SCT temperature logging.
+
 .TP
 .B \-C, \-\-captive
 Runs self\-tests in captive mode.  This has no effect with \'\-t
@@ -1284,7 +1395,7 @@ in a SMART data structure (see \'\-b\' option above).
 SMART status check returned "DISK FAILING".
 .TP
 .B Bit 4:
-SMART status check returned "DISK OK" but we found prefail Attributes <= threshold.
+We found prefail Attributes <= threshold.
 .TP
 .B Bit 5:
 SMART status check returned "DISK OK" but we found that some (usage
@@ -1366,12 +1477,12 @@ REFERENCES FOR SMART
 .fi
 An introductory article about smartmontools is \fIMonitoring Hard
 Disks with SMART\fP, by Bruce Allen, Linux Journal, January 2004,
-pages 74-77. This is \fBhttp://www.linuxjournal.com/article.php?sid=6983\fP
+pages 74\-77. This is \fBhttp://www.linuxjournal.com/article.php?sid=6983\fP
 online.
 
 If you would like to understand better how SMART works, and what it
 does, a good place to start is with Sections 4.8 and 6.54 of the first
-volume of the \'AT Attachment with Packet Interface-7\' (ATA/ATAPI-7)
+volume of the \'AT Attachment with Packet Interface\-7\' (ATA/ATAPI\-7)
 specification.  This documents the SMART functionality which the
 \fBsmartmontools\fP utilities provide access to.  You can find
 Revision 4b of this document at
@@ -1389,7 +1500,7 @@ these documents may be found in the References section of the
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartctl.8.in,v 1.90 2006/12/20 07:30:43 sxzzsf Exp $
+$Id: smartctl.8.in,v 1.103 2007/09/06 08:48:55 ballen4705 Exp $
 .\" Local Variables:            
 .\" mode: nroff         
 .\" End:
diff --git a/smartctl.8.in.orig b/smartctl.8.in.orig
new file mode 100644 (file)
index 0000000..3898fd5
--- /dev/null
@@ -0,0 +1,1358 @@
+.ig
+ Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+
+ $Id: smartctl.8.in,v 1.83 2006/09/15 08:03:52 sxzzsf 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
+ Software Foundation; either version 2, or (at your option) any later
+ version.
+ 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.
+
+ This code was originally developed as a Senior Thesis by Michael Cornwell
+ 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 CURRENT_CVS_DATE CURRENT_CVS_VERSION CURRENT_CVS_DATE
+.SH NAME
+\fBsmartctl\fP \- Control and Monitor Utility for SMART Disks
+
+.SH SYNOPSIS
+.B smartctl [options] device
+
+.SH FULL PATH
+.B /usr/local/sbin/smartctl
+
+.SH PACKAGE VERSION
+CURRENT_CVS_VERSION released CURRENT_CVS_DATE at CURRENT_CVS_TIME
+
+.SH DESCRIPTION
+\fBsmartctl\fP controls the Self\-Monitoring, Analysis and Reporting
+Technology (SMART) system built into many ATA\-3 and later ATA, IDE and
+SCSI\-3 hard drives. The purpose of SMART is to monitor the reliability
+of the hard drive and predict drive failures, and to carry out
+different types of drive self\-tests.  This version of \fBsmartctl\fP
+is compatible with ATA/ATAPI\-7 and earlier standards (see REFERENCES
+below)
+
+\fBsmartctl\fP is a command line utility designed to perform SMART
+tasks such as printing the SMART self\-test and error logs, enabling
+and disabling SMART automatic testing, and initiating device
+self\-tests. Note: if the user issues a SMART command that is
+(apparently) not implemented by the device, \fBsmartctl\fP will print
+a warning message but issue the command anyway (see the \fB\-T,
+\-\-tolerance\fP option below).  This should not cause problems: on
+most devices, unimplemented SMART commands issued to a drive are
+ignored and/or return an error.
+
+\fBsmartctl\fP also provides support for polling TapeAlert messages
+from SCSI tape drives and changers.
+
+The user must specify the device to be controlled or interrogated as
+the final argument to \fBsmartctl\fP.  Device paths are as follows:
+.IP \fBLINUX\fP: 9
+Use the forms \fB"/dev/hd[a\-t]"\fP for IDE/ATA
+devices, and \fB"/dev/sd[a\-z]"\fP for SCSI devices. For
+SCSI Tape Drives and Changers with TapeAlert support use the devices
+\fB"/dev/nst*"\fP and \fB"/dev/sg*"\fP. 
+For SATA disks accessed with libata, use \fB"/dev/sd[a\-z]"\fP
+and append \fB"\-d ata"\fP. For disks behind 3ware controllers
+you may need \fB"/dev/sd[a\-z]"\fP or \fB"/dev/twe[0\-9]"\fP
+or \fB"/dev/twa[0\-9]"\fP: see details below. For disks behind
+HighPoint RocketRAID controllers you may need \fB"/dev/sd[a\-z]"\fP.
+More general paths (such as devfs ones) may also be specified.
+.IP \fBDARWIN\fP: 9
+Use the forms \fB/dev/disk[0\-9]\fP or equivalently \fBdisk[0\-9]\fP or equivalently
+\fB/dev/rdisk[0\-9]\fP.  Long forms are also available: please use \'\-h\' to see some
+examples. Note that there is currently no Darwin SCSI support.
+.IP \fBFREEBSD\fP: 9
+Use the forms \fB"/dev/ad[0\-9]+"\fP for IDE/ATA
+devices and \fB"/dev/da[0\-9]+"\fP for SCSI devices.
+.IP \fBNETBSD/OPENBSD\fP: 9
+Use the form \fB"/dev/wd[0\-9]+c"\fP for IDE/ATA
+devices.  For SCSI disk and tape devices, use the device names
+\fB"/dev/sd[0\-9]+c"\fP and \fB"/dev/st[0\-9]+c"\fP respectively.  
+Be sure to specify the correct "whole disk" partition letter for 
+your architecture.
+.IP \fBSOLARIS\fP: 9
+Use the forms \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
+devices, and \fB"/dev/rmt/*"\fP for SCSI tape devices.
+.IP \fBWINDOWS\fP: 9
+Use the forms \fB"/dev/hd[a\-j]"\fP for IDE/ATA devices
+"\\\\.\\PhysicalDrive[0\-9]" on WinNT4/2000/XP/2003,
+and \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices on ASPI adapter 0\-9, ID 0\-15.
+For IDE/ATA devices on Win95/98/98SE/ME, use \fB"/dev/hd[a\-d]"\fP for standard devices
+accessed via SMARTVSD.VXD, and \fB"/dev/hd[e\-h]"\fP for additional devices
+accessed via a patched SMARTVSE.VXD (see INSTALL file for details).
+The prefix \fB"/dev/"\fP is optional.
+.IP \fBCYGWIN\fP: 9
+See "WINDOWS" above.
+.IP \fBOS/2,eComStation\fP: 9
+Use the form \fB"/dev/hd[a\-z]"\fP for IDE/ATA devices.
+.PP
+Based on the device path, \fBsmartctl\fP will guess the device type
+(ATA or SCSI).  If necessary, the \'\-d\' option can be used to over\-ride
+this guess
+
+Note that the printed output of \fBsmartctl\fP displays most numerical
+values in base 10 (decimal), but some values are displayed in base 16
+(hexidecimal).  To distinguish them, the base 16 values are always
+displayed with a leading \fB"0x"\fP, for example: "0xff". This man
+page follows the same convention.
+
+.PP
+.SH OPTIONS
+.PP
+The options are grouped below into several categories.  \fBsmartctl\fP
+will execute the corresponding commands in the order: INFORMATION,
+ENABLE/DISABLE, DISPLAY DATA, RUN/ABORT TESTS.
+
+SCSI devices only accept the options \fB\-h, \-V, \-i, \-a, \-A, \-d,
+\-s, \-S,\-H, \-t, \-C, \-l selftest, \-l error, \-r,\fP and
+\fB\-X\fP.  TapeAlert devices only accept the options \fB\-h, \-V,
+\-i, \-a, \-A, \-d, \-s, \-S, \-t, \-l selftest, \-l error, \-r,\fP
+and \fB\-H\fP.
+
+Long options  are  not  supported  on  all  systems.   Use
+.B \'smartctl \-h\'
+to see the available options.
+
+.TP
+.B SHOW INFORMATION OPTIONS:
+.TP
+.B \-h, \-\-help, \-\-usage
+Prints a usage message to STDOUT and exits.
+.TP
+.B \-V, \-\-version, \-\-copyright, \-\-license
+Prints version, copyright, license, home page and CVS\-id information
+for your copy of \fBsmartctl\fP to STDOUT and then exits.  Please
+include this information if you are reporting bugs or problems.
+.TP
+.B \-i, \-\-info
+Prints the device model number, serial number, firmware version, and
+ATA Standard version/revision information.  Says if the device
+supports SMART, and if so, whether SMART support is currently enabled
+or disabled.  If the device supports Logical Block Address mode (LBA
+mode) print current user drive capacity in bytes. (If drive is has a
+user protected area reserved, or is "clipped", this may be smaller
+than the potential maximum drive capacity.)  Indicates if the drive is
+in the smartmontools database (see \'\-v\' options below).  If so, the
+drive model family may also be printed. If \'\-n\' (see below) is
+specified, the power mode of the drive is printed.
+.TP
+.B \-a, \-\-all
+Prints all SMART information about the disk, or TapeAlert information
+about the tape drive or changer.  For ATA devices this is equivalent
+to
+.nf
+\'\-H \-i \-c \-A \-l error \-l selftest -l selective\'
+.fi
+and for SCSI, this is equivalent to
+.nf
+\'\-H \-i \-A \-l error \-l selftest\'.
+.fi
+Note that for ATA disks this does \fBnot\fP enable the \'\-l
+directory\' option.
+
+.TP
+.B RUN\-TIME BEHAVIOR OPTIONS:
+.TP
+.B \-q TYPE, \-\-quietmode=TYPE
+Specifies that \fBsmartctl\fP should run in one of the two quiet modes
+described here.  The valid arguments to this option are:
+
+.I errorsonly
+\- only print: For the \'\-l error\' option, if nonzero, the number
+of errors recorded in the SMART error log and the power\-on time when
+they occurred; For the \'\-l selftest\' option, errors recorded in the device
+self\-test log; For the \'\-H\' option, SMART "disk failing" status or device
+Attributes (pre\-failure or usage) which failed either now or in the
+past; For the \'\-A\' option, device Attributes (pre\-failure or usage)
+which failed either now or in the past.
+
+.I silent
+\- print no output.  The only way to learn about what was found is to
+use the exit status of \fBsmartctl\fP (see RETURN VALUES below).
+.TP
+.B \-d TYPE, \-\-device=TYPE
+Specifies the type of the device.  The valid arguments to this option
+are \fIata\fP, \fIscsi\fP, \fIsat\fP, \fImarvell\fP, \fI3ware,N\fP, and \fIhpt,L/M\fP
+or \fIhpt,L/M/N\fP.  If this option is not used then \fBsmartctl\fP will attempt to
+guess the device type from the device name.
+
+The \'sat\' device type is for ATA disks that have a SCSI to ATA
+Translation (SAT) Layer (SATL) between the disk and the operating system.
+SAT defines two ATA PASS THROUGH SCSI commands, one 12 bytes long and
+the other 16 bytes long that \fBsmartctl\fP will utilize when this device
+type is selected. The default is the 16 byte variant which can be
+overridden with either \'\-d sat,12\' or \'\-d sat,16\'.
+
+Under Linux, to look at SATA disks behind Marvell SATA controllers
+(using Marvell's \'linuxIAL\' driver rather than libata driver) use \'\-d marvell\'. Such
+controllers show up as Marvell Technology Group Ltd. SATA I or II controllers
+using lspci, or using lspci -n show a vendor ID 0x11ab and a device ID of
+either 0x5040, 0x5041, 0x5080, 0x5081, 0x6041 or 0x6081. The \'linuxIAL\' driver
+seems not (yet?) available in the Linux kernel source tree, but should be available
+from system vendors (ftp://ftp.aslab.com/ is known to provide a patch with the driver).
+
+To look at ATA disks behind 3ware SCSI RAID controllers, use syntax
+such as:
+.nf
+\fBsmartctl \-a \-d 3ware,2 /dev/sda\fP
+.fi
+.nf
+\fBsmartctl \-a \-d 3ware,0 /dev/twe0\fP
+.fi
+.nf
+\fBsmartctl \-a \-d 3ware,1 /dev/twa0\fP
+.fi
+where in the argument \fI3ware,N\fP, the integer N is the disk number
+(3ware \'port\') within the 3ware ATA RAID controller.  The allowed
+values of N are from 0 to 15 inclusive.  The first two forms, which
+refer to devices /dev/sda-z and /dev/twe0-15, may be used with 3ware
+series 6000, 7000, and 8000 series controllers that use the 3x-xxxx
+driver.  \fBNote that the /dev/sda-z form is deprecated\fP starting
+with the Linux 2.6 kernel series and may not be supported by the Linux
+kernel in the near future. The final form, which refers to devices
+/dev/twa0-15, must be used with 3ware 9000 series controllers, which
+use the 3w-9xxx driver.
+
+Note that if the special character device nodes /dev/twa? and
+/dev/twe? do not exist, or exist with the incorrect major or minor
+numbers, smartctl will recreate them on the fly.  Typically /dev/twa0
+refers to the first 9000-series controller, /dev/twa1 refers to the
+second 9000 series controller, and so on. Likewise /dev/twe0 refers to
+the first 6/7/8000-series controller, /dev/twa1 refers to the second
+6/7/8000 series controller, and so on.
+
+Note that for the 6/7/8000 controllers, \fBany\fP of the physical
+disks can be queried or examined using \fBany\fP of the 3ware's SCSI
+logical device /dev/sd?  entries.  Thus, if logical device /dev/sda is
+made up of two physical disks (3ware ports zero and one) and logical
+device /dev/sdb is made up of two other physical disks (3ware ports
+two and three) then you can examine the SMART data on \fBany\fP of the
+four physical disks using \fBeither\fP SCSI device /dev/sda \fBor\fP
+/dev/sdb.  If you need to know which logical SCSI device a particular
+physical disk (3ware port) is associated with, use the dmesg or SYSLOG
+output to show which SCSI ID corresponds to a particular 3ware unit,
+and then use the 3ware CLI or 3dm tool to determine which ports
+(physical disks) correspond to particular 3ware units.
+
+If the value of N corresponds to a port that does \fBnot\fP exist on
+the 3ware controller, or to a port that does not physically have a
+disk attached to it, the behavior of \fBsmartctl\fP depends upon the
+specific controller model, firmware, Linux kernel and platform.  In
+some cases you will get a warning message that the device does not
+exist. In other cases you will be presented with \'void\' data for a
+non\-existent device.
+
+Note that if the /dev/sd? addressing form is used, then older 3w\-xxxx
+drivers do not pass the "Enable Autosave"
+(\'\fB\-S on\fP\') and "Enable Automatic Offline" (\'\fB\-o on\fP\')
+commands to the disk, and produce these types of harmless syslog error
+messages instead: "\fB3w\-xxxx: tw_ioctl(): Passthru size (123392) too
+big\fP". This can be fixed by upgrading to version 1.02.00.037 or
+later of the 3w\-xxxx driver, or by applying a patch to older
+versions. See \fBhttp://smartmontools.sourceforge.net/\fP for
+instructions.  Alternatively, use the character device /dev/twe0-15 interface.
+
+The selective self\-test functions (\'\-t select,A\-B\') are only supported
+using the character device interface /dev/twa0\-15 and /dev/twe0\-15.
+The necessary WRITE LOG commands can not be passed through the SCSI
+interface.
+
+.B 3ware controllers are currently ONLY supported under Linux and FreeBSD.
+
+To look at (S)ATA disks behind HighPoint RocketRAID controllers, use syntax
+such as:
+.nf
+\fBsmartctl \-a \-d hpt,1/3 /dev/sda\fP
+.fi
+or
+.nf
+\fBsmartctl \-a \-d hpt,1/2/3 /dev/sda\fP
+.fi
+where in the argument \fIhpt,L/M\fP or \fIhpt,L/M/N\fP, the integer L is the
+controller id, the integer M is the channel number, and the integer N is the
+PMPort number if it is available. The allowed values of L are from 1 to 4
+inclusive, M are from 1 to 8 inclusive and N from 1 to 4 if PMPort available.
+Note that the /dev/sda-z form should be the device node which stands for
+the disks derived from the HighPoint RocketRAID controllers.  And also
+these values are limited by the model of the HighPoint RocketRAID controller.
+
+.B HighPoint RocketRAID controllers are currently ONLY supported under Linux.
+
+.TP
+.B \-T TYPE, \-\-tolerance=TYPE
+Specifies how tolerant \fBsmartctl\fP should be of ATA and SMART command
+failures. 
+
+The behavior of \fBsmartctl\fP depends upon whether the command is
+"\fBoptional\fP" or "\fBmandatory\fP". Here "\fBmandatory\fP" means
+"required by the ATA/ATAPI\-5 Specification if the device implements
+the SMART command set" and "\fBoptional\fP" means "not required by the
+ATA/ATAPI\-5 Specification even if the device implements the SMART
+command set."  The "\fBmandatory\fP" ATA and SMART commands are: (1)
+ATA IDENTIFY DEVICE, (2) SMART ENABLE/DISABLE ATTRIBUTE AUTOSAVE, (3)
+SMART ENABLE/DISABLE, and (4) SMART RETURN STATUS.
+
+The valid arguments to this option are:
+
+.I normal
+\- exit on failure of any \fBmandatory\fP SMART command, and ignore
+all failures of \fBoptional\fP SMART commands.  This is the default.
+Note that on some devices, issuing unimplemented optional SMART
+commands doesn\'t cause an error.  This can result in misleading
+\fBsmartctl\fP messages such as "Feature X not implemented", followed
+shortly by "Feature X: enabled".  In most such cases, contrary to the
+final message, Feature X is \fBnot\fP enabled.
+
+.I conservative
+\- exit on failure of any \fBoptional\fP SMART command.
+
+.I permissive
+\- ignore failure(s) of \fBmandatory\fP SMART commands.  This option
+may be given more than once.  Each additional use of this option will
+cause one more additional failure to be ignored.  Note that the use of
+this option can lead to messages like "Feature X not implemented",
+followed shortly by "Error: unable to enable Feature X".  In a few
+such cases, contrary to the final message, Feature X \fBis\fP enabled.
+
+.I verypermissive
+\- equivalent to giving a large number of \'\-T permissive\' options:
+ignore failures of \fBany number\fP of \fBmandatory\fP SMART commands.
+Please see the note above.
+
+.TP
+.B \-b TYPE, \-\-badsum=TYPE
+Specifies the action \fBsmartctl\fP should take if a checksum error is
+detected in the: (1) Device Identity Structure, (2) SMART Self\-Test
+Log Structure, (3) SMART Attribute Value Structure, (4) SMART
+Attribute Threshold Structure, or (5) ATA Error Log Structure.
+
+The valid arguments to this option are:
+
+.I warn
+\- report the incorrect checksum but carry on in spite of it.  This is the
+default.
+
+.I exit
+\- exit \fBsmartctl\fP.
+
+.I ignore
+\- continue silently without issuing a warning.
+
+.TP
+.B \-r TYPE, \-\-report=TYPE
+Intended primarily to help \fBsmartmontools\fP developers understand
+the behavior of \fBsmartmontools\fP on non\-conforming or poorly
+conforming hardware.  This option reports details of \fBsmartctl\fP
+transactions with the device.  The option can be used multiple times.
+When used just once, it shows a record of the ioctl() transactions
+with the device.  When used more than once, the detail of these
+ioctl() transactions are reported in greater detail.  The valid
+arguments to this option are:
+
+.I ioctl
+\- report all ioctl() transactions.
+
+.I ataioctl
+\- report only ioctl() transactions with ATA devices.
+
+.I scsiioctl
+\- report only ioctl() transactions with SCSI devices. Invoking this once
+shows the SCSI commands in hex and the corresponding status. Invoking
+it a second time adds a hex listing of the first 64 bytes of data send to, 
+or received from the device.
+
+Any argument may include a positive integer to specify the level of detail
+that should be reported.  The argument should be followed by a comma then
+the integer with no spaces.  For example, 
+.I ataioctl,2
+The default
+level is 1, so \'\-r ataioctl,1\' and \'\-r ataioctl\' are equivalent.
+
+.TP
+.B \-n POWERMODE, \-\-nocheck=POWERMODE
+Specifieds if \fBsmartctl\fP should exit before performing any checks
+when the device is in a low\-power mode. It may be used to prevent a disk
+from being spun\-up by \fBsmartctl\fP. The power mode is ignored by
+default. The allowed values of POWERMODE are:
+
+.I never
+\- check the device always, but print the power mode if \'\-i\' is
+specified.
+
+.I sleep
+\- check the device unless it is in SLEEP mode.
+
+.I standby
+\- check the device unless it is in SLEEP or STANDBY mode.  In
+these modes most disks are not spinning, so if you want to prevent
+a disk from spinning up, this is probably what you want.
+
+.I idle
+\- check the device unless it is in SLEEP, STANDBY or IDLE mode.
+In the IDLE state, most disks are still spinning, so this is probably
+not what you want.
+
+.TP
+.B SMART FEATURE ENABLE/DISABLE COMMANDS:
+.IP
+.B Note: 
+if multiple options are used to both enable and disable a
+feature, then 
+.B both
+the enable and disable commands will be issued.  The enable command
+will always be issued
+.B before
+the corresponding disable command.
+.TP
+.B \-s VALUE, \-\-smart=VALUE 
+Enables or disables SMART on device.  The valid arguments to
+this option are \fIon\fP and \fIoff\fP.  Note that the command \'\-s on\'
+(perhaps used with with the \'\-o on\' and \'\-S on\' options) should be placed
+in a start\-up script for your machine, for example in rc.local or rc.sysinit.
+In principle the SMART feature settings are preserved over
+power\-cycling, but it doesn\'t hurt to be sure. It is not necessary (or
+useful) to enable SMART to see the TapeAlert messages.
+.TP
+.B \-o VALUE, \-\-offlineauto=VALUE
+Enables or disables SMART automatic offline test, which scans the drive
+every four hours for disk defects. This command can be given during normal
+system operation.  The valid arguments to this option are \fIon\fP
+and \fIoff\fP.
+
+Note that the SMART automatic offline test command is listed as
+"Obsolete" in every version of the ATA and ATA/ATAPI Specifications.
+It was originally part of the SFF\-8035i Revision 2.0 specification,
+but was never part of any ATA specification.  However it is
+implemented and used by many vendors. [Good documentation can be found
+in IBM\'s Official Published Disk Specifications.  For example the IBM
+Travelstar 40GNX Hard Disk Drive Specifications (Revision 1.1, 22
+April 2002, Publication # 1541, Document S07N\-7715\-02) page 164. You
+can also read the SFF\-8035i Specification \-\- see REFERENCES below.]
+You can tell if automatic offline testing is supported by seeing if
+this command enables and disables it, as indicated by the \'Auto
+Offline Data Collection\' part of the SMART capabilities report
+(displayed with \'\-c\').
+
+SMART provides \fBthree\fP basic categories of testing.  The
+\fBfirst\fP category, called "online" testing, has no effect on the
+performance of the device.  It is turned on by the \'\-s on\' option.
+
+The \fBsecond\fP category of testing is called "offline" testing. This
+type of test can, in principle, degrade the device performance.  The
+\'\-o on\' option causes this offline testing to be carried out,
+automatically, on a regular scheduled basis.  Normally, the disk will
+suspend offline testing while disk accesses are taking place, and then
+automatically resume it when the disk would otherwise be idle, so in
+practice it has little effect.  Note that a one\-time offline test can
+also be carried out immediately upon receipt of a user command.  See
+the \'\-t offline\' option below, which causes a one\-time offline test
+to be carried out immediately.
+
+The choice (made by the SFF\-8035i and ATA specification authors) of
+the word \fItesting\fP for these first two categories is unfortunate,
+and often leads to confusion.  In fact these first two categories of
+online and offline testing could have been more accurately described
+as online and offline \fBdata collection\fP.
+
+The results of this automatic or immediate offline testing (data
+collection) are reflected in the values of the SMART Attributes.
+Thus, if problems or errors are detected, the values of these
+Attributes will go below their failure thresholds; some types of
+errors may also appear in the SMART error log. These are visible with
+the \'\-A\' and \'\-l error\' options respectively.
+
+Some SMART attribute values are updated only during off\-line data
+collection activities; the rest are updated during normal operation of
+the device or during both normal operation and off\-line testing.  The
+Attribute value table produced by the \'\-A\' option indicates this in
+the UPDATED column.  Attributes of the first type are labeled
+"Offline" and Attributes of the second type are labeled "Always".
+
+The \fBthird\fP category of testing (and the \fIonly\fP category for
+which the word \'testing\' is really an appropriate choice) is "self"
+testing.  This third type of test is only performed (immediately) when
+a command to run it is issued.  The \'\-t\' and \'\-X\' options can be
+used to carry out and abort such self\-tests; please see below for
+further details.
+
+Any errors detected in the self testing will be shown in the
+SMART self\-test log, which can be examined using the \'\-l selftest\'
+option.
+
+\fBNote:\fP in this manual page, the word \fB"Test"\fP is used in
+connection with the second category just described, e.g. for the
+"offline" testing.  The words \fB"Self\-test"\fP are used in
+connection with the third category.
+.TP
+.B \-S VALUE, \-\-saveauto=VALUE
+Enables or disables SMART autosave of device vendor\-specific
+Attributes. The valid arguments to this option are \fIon\fP
+and \fIoff\fP.  Note that this feature is preserved across disk power
+cycles, so you should only need to issue it once.
+
+For SCSI devices this toggles the value of the Global Logging Target
+Save Disabled (GLTSD) bit in the Control Mode Page. Some disk
+manufacturers set this bit by default. This prevents error counters,
+power\-up hours and other useful data from being placed in non\-volatile
+storage, so these values may be reset to zero the next time the device
+is power\-cycled.  If the GLTSD bit is set then \'smartctl \-a\' will
+issue a warning. Use \fIon\fP to clear the GLTSD bit and thus enable
+saving counters to non\-volatile storage. For extreme streaming\-video
+type applications you might consider using \fIoff\fP to set the GLTSD
+bit.
+
+.TP
+.B SMART READ AND DISPLAY DATA OPTIONS:
+.TP
+.B \-H, \-\-health
+Check: Ask the device to report its SMART health status or pending
+TapeAlert messages.  SMART status is based on
+information that it has gathered from online and offline
+tests, which were used to determine/update its
+SMART vendor\-specific Attribute values. TapeAlert status is obtained
+by reading the TapeAlert log page.
+
+If the device reports failing health status, this means
+.B either
+that the device has already failed, 
+.B or 
+that it is predicting its own failure within the next 24 hours.  If
+this happens, use the \'\-a\' option to get more information, and
+.B get your data off the disk and someplace safe as soon as you can.
+.TP
+.B \-c, \-\-capabilities
+Prints only the generic SMART capabilities.  These show
+what SMART features are implemented and how the device will
+respond to some of the different SMART commands.  For example it
+shows if the device logs errors, if it supports offline surface
+scanning, and so on.  If the device can carry out self\-tests, this
+option also shows the estimated time required to run those tests.
+
+Note that the time required to run the Self\-tests (listed in minutes)
+are fixed.  However the time required to run the Immediate Offline
+Test (listed in seconds) is variable.  This means that if you issue a
+command to perform an Immediate Offline test with the \'\-t offline\' option,
+then the time may jump to a larger value and then count down as the
+Immediate Offline Test is carried out.  Please see REFERENCES below
+for further information about the the flags and capabilities described
+by this option.
+.TP
+.B \-A, \-\-attributes
+Prints only the vendor specific SMART Attributes.  The Attributes are
+numbered from 1 to 253 and have specific names and ID numbers. For
+example Attribute 12 is "power cycle count": how many times has the
+disk been powered up.
+
+Each Attribute has a "Raw" value, printed under the heading
+"RAW_VALUE", and a "Normalized" value printed under the heading
+"VALUE".  [Note: \fBsmartctl\fP prints these values in base\-10.]  In
+the example just given, the "Raw Value" for Attribute 12 would be the
+actual number of times that the disk has been power\-cycled, for
+example 365 if the disk has been turned on once per day for exactly
+one year.  Each vendor uses their own algorithm to convert this "Raw"
+value to a "Normalized" value in the range from 1 to 254.  Please keep
+in mind that \fBsmartctl\fP only reports the different Attribute
+types, values, and thresholds as read from the device.  It does
+\fBnot\fP carry out the conversion between "Raw" and "Normalized"
+values: this is done by the disk\'s firmware.
+
+The conversion from Raw value to a quantity with physical units is
+not specified by the SMART standard. In most cases, the values printed
+by \fBsmartctl\fP are sensible.  For example the temperature Attribute
+generally has its raw value equal to the temperature in Celsius.
+However in some cases vendors use unusual conventions.  For example
+the Hitachi disk on my laptop reports its power\-on hours in minutes,
+not hours. Some IBM disks track three temperatures rather than one, in
+their raw values.  And so on.
+
+Each Attribute also has a Threshold value (whose range is 0 to 255)
+which is printed under the heading "THRESH".  If the Normalized value
+is \fBless than or equal to\fP the Threshold value, then the Attribute
+is said to have failed.  If the Attribute is a pre\-failure Attribute,
+then disk failure is imminent.
+
+Each Attribute also has a "Worst" value shown under the heading
+"WORST".  This is the smallest (closest to failure) value that the
+disk has recorded at any time during its lifetime when SMART was
+enabled.  [Note however that some vendors firmware may actually
+\fBincrease\fP the "Worst" value for some "rate\-type" Attributes.]
+
+The Attribute table printed out by \fBsmartctl\fP also shows the
+"TYPE" of the Attribute. Attributes are one of two possible types:
+Pre\-failure or Old age.  Pre\-failure Attributes are ones which, if
+less than or equal to their threshold values, indicate pending disk
+failure.  Old age, or usage Attributes, are ones which indicate
+end\-of\-product life from old\-age or normal aging and wearout, if
+the Attribute value is less than or equal to the threshold.  \fBPlease
+note\fP: the fact that an Attribute is of type 'Pre\-fail' does
+\fBnot\fP mean that your disk is about to fail!  It only has this
+meaning if the Attribute\'s current Normalized value is less than or
+equal to the threshold value.
+
+If the Attribute\'s current Normalized value is less than or equal to
+the threshold value, then the "WHEN_FAILED" column will display
+"FAILING_NOW". If not, but the worst recorded value is less than or
+equal to the threshold value, then this column will display
+"In_the_past".  If the "WHEN_FAILED" column has no entry (indicated by
+a dash: \'\-\') then this Attribute is OK now (not failing) and has
+also never failed in the past.
+
+The table column labeled "UPDATED" shows if the SMART Attribute values
+are updated during both normal operation and off\-line testing, or
+only during offline testing.  The former are labeled "Always" and the
+latter are labeled "Offline".
+
+So to summarize: the Raw Attribute values are the ones that might have
+a real physical interpretation, such as "Temperature Celsius",
+"Hours", or "Start\-Stop Cycles".  Each manufacturer converts these,
+using their detailed knowledge of the disk\'s operations and failure
+modes, to Normalized Attribute values in the range 1\-254.  The
+current and worst (lowest measured) of these Normalized Attribute
+values are stored on the disk, along with a Threshold value that the
+manufacturer has determined will indicate that the disk is going to
+fail, or that it has exceeded its design age or aging limit.
+\fBsmartctl\fP does \fBnot\fP calculate any of the Attribute values,
+thresholds, or types, it merely reports them from the SMART data on
+the device.
+
+Note that starting with ATA/ATAPI\-4, revision 4, the meaning of these
+Attribute fields has been made entirely vendor\-specific.  However most
+ATA/ATAPI\-5 disks seem to respect their meaning, so we have retained
+the option of printing the Attribute values.
+
+For SCSI devices the "attributes" are obtained from the temperature
+and start-stop cycle counter log pages. Certain vendor specific
+attributes are listed if recognised. The attributes are output in a
+relatively free format (compared with ATA disk attributes).
+.TP
+.B \-l TYPE, \-\-log=TYPE
+Prints either the SMART Error Log, the SMART Self\-Test Log, the SMART
+Selective Self\-Test Log [ATA only], or the Log Directory [ATA only].
+The valid arguments to this option are:
+
+.I error
+\- prints only the SMART error log.  SMART disks maintain a log of the
+most recent five non\-trivial errors. For each of these errors, the
+disk power\-on lifetime at which the error occurred is recorded, as is
+the device status (idle, standby, etc) at the time of the error.  For
+some common types of errors, the Error Register (ER) and Status
+Register (SR) values are decoded and printed as text. The meanings of these
+are:
+.nf
+   \fBABRT\fP:  Command \fBAB\fPo\fBRT\fPed
+   \fBAMNF\fP:  \fBA\fPddress \fBM\fPark \fBN\fPot \fBF\fPound
+   \fBCCTO\fP:  \fBC\fPommand \fBC\fPompletion \fBT\fPimed \fBO\fPut
+   \fBEOM\fP:   \fBE\fPnd \fBO\fPf \fBM\fPedia
+   \fBICRC\fP:  \fBI\fPnterface \fBC\fPyclic \fBR\fPedundancy \fBC\fPode (CRC) error
+   \fBIDNF\fP:  \fBID\fPentity \fBN\fPot \fBF\fPound
+   \fBILI\fP:   (packet command\-set specific)
+   \fBMC\fP:    \fBM\fPedia \fBC\fPhanged
+   \fBMCR\fP:   \fBM\fPedia \fBC\fPhange \fBR\fPequest
+   \fBNM\fP:    \fBN\fPo \fBM\fPedia
+   \fBobs\fP:   \fBobs\fPolete
+   \fBTK0NF\fP: \fBT\fPrac\fBK 0 N\fPot \fBF\fPound
+   \fBUNC\fP:   \fBUNC\fPorrectable Error in Data
+   \fBWP\fP:    Media is \fBW\fPrite \fBP\fProtected
+.fi
+In addition, up to the last five commands that preceded the error are
+listed, along with a timestamp measured from the start of the
+corresponding power cycle. This is displayed in the form
+Dd+HH:MM:SS.msec where D is the number of days, HH is hours, MM is
+minutes, SS is seconds and msec is milliseconds.  [Note: this time
+stamp wraps after 2^32 milliseconds, or 49 days 17 hours 2 minutes and
+47.296 seconds.]  The key ATA disk registers are also recorded in the
+log.  The final column of the error log is a text\-string description
+of the ATA command defined by the Command Register (CR) and Feature
+Register (FR) values.  Commands that are obsolete in the most current
+(ATA\-7) spec are listed like this: \fBREAD LONG (w/ retry) [OBS\-4]\fP,
+indicating that the command became obsolete with or in the ATA\-4
+specification.  Similarly, the notation \fB[RET\-\fP\fIN\fP\fB]\fP is
+used to indicate that a command was retired in the ATA\-\fIN\fP
+specification.  Some commands are not defined in any version of the
+ATA specification but are in common use nonetheless; these are marked
+\fB[NS]\fP, meaning non\-standard.
+
+The ATA Specification (ATA\-5 Revision 1c, Section 8.41.6.8.2) says:
+\fB"Error log structures shall include UNC errors, IDNF errors for
+which the address requested was valid, servo errors, write fault
+errors, etc.  Error log data structures shall not include errors
+attributed to the receipt of faulty commands such as command codes not
+implemented by the device or requests with invalid parameters or
+invalid addresses."\fP The definitions of these terms are:
+.br
+\fBUNC\fP (\fBUNC\fPorrectable): data is uncorrectable.  This refers
+to data which has been read from the disk, but for which the Error
+Checking and Correction (ECC) codes are inconsistent.  In effect, this
+means that the data can not be read.
+.br
+\fBIDNF\fP (\fBID N\fPot \fBF\fPound): user\-accessible address could
+not be found. For READ LOG type commands, \fBIDNF\fP can also indicate
+that a device data log structure checksum was incorrect.
+
+If the command that caused the error was a READ or WRITE command, then
+the Logical Block Address (LBA) at which the error occurred will be
+printed in base 10 and base 16.  The LBA is a linear address, which
+counts 512\-byte sectors on the disk, starting from zero.  (Because of
+the limitations of the SMART error log, if the LBA is greater than
+0xfffffff, then either no error log entry will be made, or the error
+log entry will have an incorrect LBA. This may happen for drives with
+a capacity greater than 128 GiB or 137 GB.) On Linux systems the
+smartmontools web page has instructions about how to convert the LBA
+address to the name of the disk file containing the erroneous disk
+sector.
+
+Please note that some manufacturers \fBignore\fP the ATA
+specifications, and make entries in the error log if the device
+receives a command which is not implemented or is not valid.
+
+.I error [SCSI]
+\- prints the error counter log pages for reads, write and verifies.
+The verify row is only output if it has an element other than zero.
+
+.I selftest
+\- prints the SMART self\-test log.  The disk maintains a self\-test log
+showing the results of the self tests, which can be run using the
+\'\-t\' option described below.  For each of the most recent
+twenty\-one self\-tests, the log shows the type of test (short or
+extended, off\-line or captive) and the final status of the test.  If
+the test did not complete successfully, then the percentage of the
+test remaining is shown.  The time at which the test took place,
+measured in hours of disk lifetime, is also printed.  If any errors
+were detected, the Logical Block Address (LBA) of the first error is
+printed in decimal notation. On Linux systems the smartmontools
+web page has instructions about how to convert this LBA address to the
+name of the disk file containing the erroneous block.
+
+.I selftest [SCSI]
+\- the self\-test log for a SCSI device has a slightly different format
+than for an ATA device.  For each of the most recent twenty
+self\-tests, it shows the type of test and the status (final or in
+progress) of the test. SCSI standards use the terms "foreground" and
+"background" (rather than ATA\'s corresponding "captive" and
+"off\-line") and "short" and "long" (rather than ATA\'s corresponding
+"short" and "extended") to describe the type of the test.  The printed
+segment number is only relevant when a test fails in the third or
+later test segment.  It identifies the test that failed and consists
+of either the number of the segment that failed during the test, or
+the number of the test that failed and the number of the segment in
+which the test was run, using a vendor\-specific method of putting both
+numbers into a single byte.  The Logical Block Address (LBA) of the
+first error is printed in hexadecimal notation.  On Linux systems the
+smartmontools web page has instructions about how to convert this LBA
+address to the name of the disk file containing the erroneous block.
+If provided, the SCSI Sense Key (SK), Additional Sense Code (ASC) and
+Additional Sense Code Qualifier (ASQ) are also printed. The self tests
+can be run using the \'\-t\' option described below (using the ATA
+test terminology).
+
+.I selective [ATA]
+\- Some ATA\-7 disks (example: Maxtor) also maintain a selective
+self\-test log.  Please see the \'\-t select\' option below for a
+description of selective self\-tests.  The selective self\-test log
+shows the start/end Logical Block Addresses (LBA) of each of the five
+test spans, and their current test status.  If the span is being
+tested or the remainder of the disk is being read\-scanned, the
+current 65536\-sector block of LBAs being tested is also displayed.
+The selective self\-test log also shows if a read\-scan of the
+remainder of the disk will be carried out after the selective
+self\-test has completed (see \'\-t afterselect\' option) and the time
+delay before restarting this read\-scan if it is interrupted (see
+\'\-t pending\' option). This is a new smartmontools feature; please
+report unusual or incorrect behavior to the smartmontools\-support
+mailing list.
+
+.I directory
+\- if the device supports the General Purpose Logging feature set
+(ATA\-6 and ATA\-7 only) then this prints the Log Directory (the log at
+address 0).  The Log Directory shows what logs are available and their
+length in sectors (512 bytes).  The contents of the logs at address 1
+[Summary SMART error log] and at address 6 [SMART self\-test log] may
+be printed using the previously\-described
+.I error
+and
+.I selftest
+arguments to this option. [Please note: this is a new, experimental
+feature.  We would like to add support for printing the contents of
+extended and comprehensive SMART self\-test and error logs.  If your
+disk supports these, and you would like to assist, please contact the
+\fBsmartmontools\fP developers.]
+
+.TP
+.B \-v N,OPTION, \-\-vendorattribute=N,OPTION
+Sets a vendor\-specific display OPTION for Attribute N.  This option
+may be used multiple times. Valid arguments to this option are:
+
+.I help
+\- Prints (to STDOUT) a list of all valid arguments to this option,
+then exits.
+
+.I 9,minutes
+\- Raw Attribute number 9 is power\-on time in minutes.  Its raw value
+will be displayed in the form "Xh+Ym".  Here X is hours, and Y is
+minutes in the range 0\-59 inclusive.  Y is always printed with two
+digits, for example "06" or "31" or "00".
+
+.I 9,seconds
+\- Raw Attribute number 9 is power\-on time in seconds.  Its raw value
+will be displayed in the form "Xh+Ym+Zs".  Here X is hours, Y is
+minutes in the range 0\-59 inclusive, and Z is seconds in the range
+0\-59 inclusive.  Y and Z are always printed with two digits, for
+example "06" or "31" or "00".
+
+.I 9,halfminutes
+\- Raw Attribute number 9 is power\-on time, measured in units of 30
+seconds.  This format is used by some Samsung disks.  Its raw value
+will be displayed in the form "Xh+Ym".  Here X is hours, and Y is
+minutes in the range 0\-59 inclusive.  Y is always printed with two
+digits, for example "06" or "31" or "00".
+
+.I 9,temp
+\- Raw Attribute number 9 is the disk temperature in Celsius.
+
+.I 192,emergencyretractcyclect
+\- Raw Attribute number 192 is the Emergency Retract Cycle Count.
+
+.I 193,loadunload
+\- Raw Attribute number 193 contains two values. The first is the
+number of load cycles.  The second is the number of unload cycles.
+The difference between these two values is the number of times that
+the drive was unexpectedly powered off (also called an emergency
+unload). As a rule of thumb, the mechanical stress created by one
+emergency unload is equivalent to that created by one hundred normal
+unloads.
+
+.I 194,10xCelsius
+\- Raw Attribute number 194 is ten times the disk temperature in
+Celsius.  This is used by some Samsung disks (example: model SV1204H
+with RK100\-13 firmware).
+
+.I 194,unknown
+\- Raw Attribute number 194 is NOT the disk temperature, and its
+interpretation is unknown. This is primarily useful for the \-P
+(presets) option.
+
+.I 198,offlinescanuncsectorct
+\- Raw Attribute number 198 is the Offline Scan UNC Sector Count.
+
+.I 200,writeerrorcount
+\- Raw Attribute number 200 is the Write Error Count.
+
+.I 201,detectedtacount
+\- Raw Attribute number 201 is the Detected TA Count.
+
+.I 220,temp
+\- Raw Attribute number 220 is the disk temperature in Celsius.
+
+Note: a table of hard drive models, listing which Attribute
+corresponds to temperature, can be found at:
+\fBhttp://www.guzu.net/linux/hddtemp.db\fP
+
+.I N,raw8
+\- Print the Raw value of Attribute N as six 8\-bit unsigned base\-10
+integers.  This may be useful for decoding the meaning of the Raw
+value.  The form \'N,raw8\' prints Raw values for ALL Attributes in this
+form.  The form (for example) \'123,raw8\' only prints the Raw value for
+Attribute 123 in this form.
+
+.I N,raw16
+\- Print the Raw value of Attribute N as three 16\-bit unsigned base\-10
+integers.  This may be useful for decoding the meaning of the Raw
+value.  The form \'N,raw16\' prints Raw values for ALL Attributes in this
+form.  The form (for example) \'123,raw16\' only prints the Raw value for
+Attribute 123 in this form.
+
+.I N,raw48
+\- Print the Raw value of Attribute N as a 48\-bit unsigned base\-10
+integer.  This may be useful for decoding the meaning of the Raw
+value.  The form \'N,raw48\' prints Raw values for ALL Attributes in
+this form.  The form (for example) \'123,raw48\' only prints the Raw
+value for Attribute 123 in this form.
+
+.TP
+.B \-F TYPE, \-\-firmwarebug=TYPE
+Modifies the behavior of \fBsmartctl\fP to compensate for some known
+and understood device firmware bug.  The arguments to this option are
+exclusive, so that only the final option given is used.  The valid
+values are:
+
+.I none
+\- Assume that the device firmware obeys the ATA specifications.  This
+is the default, unless the device has presets for \'\-F\' in the
+device database (see note below).
+
+.I samsung
+\- In some Samsung disks (example: model SV4012H Firmware Version:
+RM100\-08) some of the two\- and four\-byte quantities in the SMART data
+structures are byte\-swapped (relative to the ATA specification).
+Enabling this option tells \fBsmartctl\fP to evaluate these quantities
+in byte\-reversed order.  Some signs that your disk needs this option
+are (1) no self\-test log printed, even though you have run self\-tests;
+(2) very large numbers of ATA errors reported in the ATA error log;
+(3) strange and impossible values for the ATA error log timestamps.
+
+.I samsung2
+\- In more recent Samsung disks (firmware revisions ending in "\-23")
+the number of ATA errors reported is byte swapped.  Enabling this
+option tells \fBsmartctl\fP to evaluate this quantity in
+byte\-reversed order. An indication that your Samsung disk needs this
+option is that the self-test log is printed correctly, but there are a
+very large number of errors in the SMART error log.  This is because
+the error count is byte swapped.  Thus a disk with five errors
+(0x0005) will appear to have 20480 errors (0x5000).
+
+Note that an explicit \'\-F\' option on the command line will
+over\-ride any preset values for \'\-F\' (see the \'\-P\' option
+below).
+
+.TP
+.B \-P TYPE, \-\-presets=TYPE
+Specifies whether \fBsmartctl\fP should use any preset options that
+are available for this drive. By default, if the drive is recognized
+in the \fBsmartmontools\fP database, then the presets are used.
+
+\fBsmartctl\fP can automatically set appropriate options for known
+drives.  For example, the Maxtor 4D080H4 uses Attribute 9 to stores
+power\-on time in minutes whereas most drives use that Attribute to
+store the power\-on time in hours.  The command\-line option \'\-v
+9,minutes\' ensures that \fBsmartctl\fP correctly interprets Attribute
+9 in this case, but that option is preset for the Maxtor 4D080H4 and
+so need not be specified by the user on the \fBsmartctl\fP command
+line.
+
+The argument
+.I show
+will show any preset options for your drive and the argument
+.I showall
+will show all known drives in the \fBsmartmontools\fP database, along
+with their preset options.  If there are no presets for your drive and
+you think there should be (for example, a \-v or \-F option is needed
+to get \fBsmartctl\fP to display correct values) then please contact
+the \fBsmartmontools\fP developers so that this information can be
+added to the \fBsmartmontools\fP database.  Contact information is at the
+end of this man page.
+
+The valid arguments to this option are:
+
+.I use
+\- if a drive is recognized, then use the stored presets for it.  This
+is the default. Note that presets will NOT over\-ride additional
+Attribute interpretation (\'\-v N,something\') command\-line options or
+explicit \'\-F\' command\-line options..
+
+.I ignore
+\- do not use presets.
+
+.I show
+\- show if the drive is recognized in the database, and if so, its
+presets, then exit.
+
+.I showall
+\- list all recognized drives, and the presets that are set for them,
+then exit.
+
+The \'\-P showall\' option takes up to two optional arguments to
+match a specific drive type and firmware version. The command:
+.nf
+  smartctl \-P showall
+.fi
+lists all entries, the command:
+.nf
+  smartctl \-P showall \'MODEL\'
+.fi
+lists all entries matching MODEL, and the command:
+.nf
+  smartctl \-P showall \'MODEL\' \'FIRMWARE\'
+.fi
+lists all entries for this MODEL and a specific FIRMWARE version.
+
+.TP
+.B SMART RUN/ABORT OFFLINE TEST AND SELF\-TEST OPTIONS:
+.TP
+.B \-t TEST, \-\-test=TEST
+Executes TEST immediately.  The \'\-C\' option can be used in
+conjunction with this option to run the short or long (and also for
+ATA devices, selective or conveyance) self\-tests in captive mode
+(known as "foreground mode" for SCSI devices).  Note that only one
+test type can be run at a time, so only one test type should be
+specified per command line.  Note also that if a computer is shutdown
+or power cycled during a self\-test, no harm should result.  The
+self\-test will either be aborted or will resume automatically.
+
+The valid arguments to this option are:  
+
+.I offline
+\- runs SMART Immediate Offline Test.  This immediately
+starts the test described above.  This command can be given during
+normal system operation.  The effects of this test are visible only in
+that it updates the SMART Attribute values, and if errors are
+found they will appear in the SMART error log, visible with the \'\-l error\'
+option. [In the case of SCSI devices runs the default self test in
+foreground. No entry is placed in the self test log.]
+
+If the \'\-c\' option to \fBsmartctl\fP shows that the device has the
+"Suspend Offline collection upon new command" capability then you can
+track the progress of the Immediate Offline test using the \'\-c\'
+option to \fBsmartctl\fP.  If the \'\-c\' option show that the device
+has the "Abort Offline collection upon new command" capability then
+most commands will abort the Immediate Offline Test, so you should not
+try to track the progress of the test with \'\-c\', as it will abort
+the test.
+
+.I short
+\- runs SMART Short Self Test (usually under ten minutes).
+[Note: in the case of SCSI devices,
+this command option runs the "Background short" self\-test.]
+This command can be given during normal system operation (unless run in
+captive mode \- see the \'\-C\' option below).  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 selftest\' option.  Note that on some disks the progress of the
+self\-test can be monitored by watching this log during the self\-test; with other disks
+use the \'\-c\' option to monitor progress.
+
+.I long
+\- runs SMART Extended Self Test (tens of minutes).
+[Note: in the case of SCSI devices,
+this command option runs the "Background long" self\-test.]
+This is a
+longer and more thorough version of the Short Self Test described
+above.  Note that this command can be given during normal
+system operation (unless run in captive mode \- see the \'\-C\' option below).
+
+.I conveyance
+\- [ATA ONLY] runs a SMART Conveyance Self Test (minutes).  This
+self\-test routine is intended to identify damage incurred during
+transporting of the device. This self\-test routine should take on the
+order of minutes to complete.  Note that this command can be given
+during normal system operation (unless run in captive mode \- see the
+\'\-C\' option below).
+
+.I select,N\-M
+\- [ATA ONLY] [NEW EXPERIMENTAL SMARTCTL FEATURE] runs a SMART
+Selective Self Test, to test a \fBrange\fP of disk Logical Block
+Addresses (LBAs), rather than the entire disk.  Each range of LBAs
+that is checked is called a "span" and is specified by a starting LBA
+(N) and an ending LBA (M) with N less than or equal to M.  For example
+the command:
+.nf
+  smartctl \-t select,10\-20 /dev/hda
+.fi
+runs a self test on one span consisting of LBAs ten to twenty
+(inclusive). The \'\-t\' option can be given up to five times, to test
+up to five spans.  For example the command:
+.nf
+  smartctl \-t select,0\-100 \-t select,1000\-2000 /dev/hda
+.fi
+runs a self test on two spans.  The first span consists of 101 LBAs
+and the second span consists of 1001 LBAs.  Note that the spans can
+overlap partially or completely, for example:
+.nf
+  smartctl \-t select,0\-10 \-t select,5\-15 \-t select,10\-20 /dev/hda
+.fi
+The results of the selective self\-test can be obtained (both during
+and after the test) by printing the SMART self\-test log, using the
+\'\-l selftest\' option to smartctl.
+
+Selective self tests are particularly useful as disk capacities
+increase: an extended self test (smartctl \-t long) can take several
+hours.  Selective self\-tests are helpful if (based on SYSLOG error
+messages, previous failed self\-tests, or SMART error log entries) you
+suspect that a disk is having problems at a particular range of
+Logical Block Addresses (LBAs).
+
+Selective self\-tests can be run during normal system operation (unless
+done in captive mode \- see the \'\-C\' option below).
+
+[Note: this new experimental smartmontools feature is currently only
+available under Linux.  The Linux kernel must be compiled with the
+configuration option CONFIG_IDE_TASKFILE_IO enabled.  Please report
+unusual or incorrect behavior to the smartmontools\-support mailing
+list.]
+
+.I afterselect,on
+\- [ATA ONLY] perform an offline read scan after a Selective Self\-test
+has completed. This option must be used together with one or more of
+the \fIselect,N\-M\fP options above. If the LBAs that have been
+specified in the Selective self\-test pass the test with no errors
+found, then read scan the \fBremainder\fP of the disk.  If the device
+is powered\-cycled while this read scan is in progress, the read scan
+will be automatically resumed after a time specified by the pending
+timer (see below).  The value of this option is preserved between
+selective self\-tests.
+
+.I afterselect,off
+\- [ATA ONLY] do not read scan the remainder of the disk after a
+Selective self\-test has completed.  This option must be use together
+with one or more of the \fIselect,N\-M\fP options above.  The value of this
+option is preserved between selective self\-tests.
+
+.I pending,N 
+\- [ATA ONLY] set the pending offline read scan timer to N minutes.
+Here N is an integer in the range from 0 to 65535 inclusive.  If the
+device is powered off during a read scan after a Selective self\-test,
+then resume the test automatically N minutes after power\-up.  This
+option must be use together with one or more of the \fIselect,N\-M\fP
+options above. The value of this option is preserved between selective
+self\-tests.
+
+.TP
+.B \-C, \-\-captive
+Runs self\-tests in captive mode.  This has no effect with \'\-t
+offline\' or if the \'\-t\' option is not used. [Note: in the case of
+SCSI devices, this command option runs the self\-test in "Foreground"
+mode.]
+
+\fBWARNING: Tests run in captive mode may busy out the drive for the
+length of the test.  Only run captive tests on drives without any
+mounted partitions!\fP
+
+.TP
+.B \-X, \-\-abort
+Aborts non\-captive SMART Self Tests.  Note that this
+command will abort the Offline Immediate Test routine only if your
+disk has the "Abort Offline collection upon new command" capability.
+.PP
+.SH EXAMPLES
+.nf
+.B smartctl \-a /dev/hda
+.fi
+Print all SMART information for drive /dev/hda (Primary Master).
+.PP
+.nf
+.B smartctl \-s off /dev/hdd
+.fi
+Disable SMART on drive /dev/hdd (Secondary Slave).
+.PP
+.nf
+.B smartctl \-\-smart=on \-\-offlineauto=on \-\-saveauto=on /dev/hda
+.fi
+Enable SMART on drive /dev/hda, enable automatic offline
+testing every four hours, and enable autosaving of
+SMART Attributes.  This is a good start\-up line for your system\'s
+init files.  You can issue this command on a running system.
+.PP
+.nf
+.B smartctl \-t long /dev/hdc
+.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 selftest\' option after it has completed.
+.PP
+.nf
+.B smartctl \-s on \-t offline /dev/hda
+.fi
+Enable SMART on the disk, and begin an immediate offline test of
+drive /dev/hda.  You can issue this command on a running system.  The
+results are only used to update the SMART Attributes, visible
+with the \'\-A\' option.  If any device errors occur, they are logged to
+the SMART error log, which can be seen with the \'\-l error\' option.
+.PP
+.nf
+.B smartctl \-A \-v 9,minutes /dev/hda
+.fi
+Shows the vendor Attributes, when the disk stores its power\-on time
+internally in minutes rather than hours.
+.PP
+.nf
+.B smartctl \-q errorsonly \-H \-l selftest /dev/hda
+.fi
+Produces output only if the device returns failing SMART status,
+or if some of the logged self\-tests ended with errors.
+.PP
+.nf
+.B smartctl \-q silent \-a /dev/hda
+.fi
+Examine all SMART 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
+SMART 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
+.nf
+.B smartctl \-a \-d 3ware,0 /dev/sda
+.fi
+Examine all SMART data for the first ATA disk connected to a 3ware
+RAID controller card.
+.PP
+.nf
+.B smartctl \-a \-d 3ware,0 /dev/twe0
+.fi
+Examine all SMART data for the first ATA disk connected to a 3ware
+RAID 6000/7000/8000 controller card.
+.PP
+.nf
+.B smartctl \-a \-d 3ware,0 /dev/twa0
+.fi
+Examine all SMART data for the first ATA disk connected to a 3ware
+RAID 9000 controller card.
+.PP
+.nf
+.B smartctl \-t short \-d 3ware,3 /dev/sdb
+.fi
+Start a short self\-test on the fourth ATA disk connected to the 3ware RAID
+controller card which is the second SCSI device /dev/sdb.
+.PP
+.nf
+.B smartctl \-a \-d hpt,1/3 /dev/sda
+.fi
+Examine all SMART data for the (S)ATA disk directly connected to the third channel of the
+first HighPoint RocketRAID controller card.
+.nf
+.PP
+.nf
+.B smartctl \-t short \-d hpt,1/1/2 /dev/sda
+.fi
+Start a short self\-test on the (S)ATA disk connected to second pmport on the
+first channel of the first HighPoint RocketRAID controller card.
+.PP
+.nf
+.B smartctl \-t select,10\-100 \-t select,30\-300 \-t afterselect,on \-t pending,45 /dev/hda
+.fi
+Run a selective self\-test on LBAs 10 to 100 and 30 to 300.  After the
+these LBAs have been tested, read\-scan the remainder of the disk.  If the disk is
+power\-cycled during the read\-scan, resume the scan 45 minutes after power to the
+device is restored.
+.PP
+.SH RETURN VALUES
+The return values of \fBsmartctl\fP are defined by a bitmask.  If all
+is well with the disk, the return value (exit status) of
+\fBsmartctl\fP is 0 (all bits turned off).  If a problem occurs, or an
+error, potential error, or fault is detected, then a non\-zero status
+is returned.  In this case, the eight different bits in the return
+value have the following meanings for ATA disks; some of these values
+may also be returned for SCSI disks.
+.TP
+.B Bit 0:
+Command line did not parse.
+.TP
+.B Bit 1:
+Device open failed, or device did not return an IDENTIFY DEVICE structure. 
+.TP
+.B Bit 2:
+Some SMART command to the disk failed, or there was a checksum error
+in a SMART data structure (see \'\-b\' option above).
+.TP
+.B Bit 3:
+SMART status check returned "DISK FAILING".
+.TP
+.B Bit 4:
+SMART status check returned "DISK OK" but we found prefail Attributes <= threshold.
+.TP
+.B Bit 5:
+SMART status check returned "DISK OK" but we found that some (usage
+or prefail) Attributes have been <= threshold at some time in the
+past. 
+.TP
+.B Bit 6:
+The device error log contains records of errors.
+.TP
+.B Bit 7:
+The device self\-test log contains records of errors.
+
+To test within the shell for whether or not the different bits are
+turned on or off, you can use the following type of construction (this
+is bash syntax):
+.nf
+.B smartstat=$(($? & 8))
+.fi
+This looks at only at bit 3 of the exit status
+.B $?
+(since 8=2^3).  The shell variable
+$smartstat will be nonzero if SMART status check returned "disk
+failing" and zero otherwise.
+
+.PP
+.SH NOTES
+The TapeAlert log page flags are cleared for the initiator when the
+page is read. This means that each alert condition is reported only
+once by \fBsmartctl\fP for each initiator for each activation of the
+condition.
+
+.PP
+.SH AUTHOR
+\fBBruce Allen\fP smartmontools\-support@lists.sourceforge.net
+.fi
+University of Wisconsin \- Milwaukee Physics Department
+.PP
+.SH CONTRIBUTORS
+The following have made large contributions to smartmontools:
+.nf
+\fBCasper Dik\fP (Solaris SCSI interface)
+\fBChristian Franke\fP (Windows interface and Cygwin package)
+\fBDouglas Gilbert\fP (SCSI subsystem)
+\fBGuido Guenther\fP (Autoconf/Automake packaging)
+\fBGeoffrey Keating\fP (Darwin ATA interface)
+\fBEduard Martinescu\fP (FreeBSD interface)
+\fBFr\*'ed\*'eric L. W. Meunier\fP (Web site and Mailing list)
+\fBKeiji Sawada\fP (Solaris ATA interface)
+\fBSergey Svishchev\fP (NetBSD interface)
+\fBDavid Snyder and Sergey Svishchev\fP (OpenBSD interface)
+\fBPhil Williams\fP (User interface and drive database)
+\fBYuri Dario\fP (OS/2, eComStation interface)
+.fi
+Many other individuals have made smaller contributions and corrections.
+
+.PP
+.SH CREDITS
+.fi
+This code was derived from the smartsuite package, written by Michael
+Cornwell, and from the previous UCSC smartsuite package.  It extends
+these to cover ATA\-5 disks.  This code was originally developed as a
+Senior Thesis by Michael Cornwell at the Concurrent Systems Laboratory
+(now part of the Storage Systems Research Center), Jack Baskin School
+of Engineering, University of California, Santa
+Cruz. \fBhttp://ssrc.soe.ucsc.edu/\fP .
+.SH
+HOME PAGE FOR SMARTMONTOOLS: 
+.fi
+Please see the following web site for updates, further documentation, bug
+reports and patches: \fBhttp://smartmontools.sourceforge.net/\fP
+
+.SH
+SEE ALSO:
+\fBsmartd\fP(8), \fBbadblocks\fP(8), \fBide\-smart\fP(8).
+.SH
+REFERENCES FOR SMART
+.fi
+An introductory article about smartmontools is \fIMonitoring Hard
+Disks with SMART\fP, by Bruce Allen, Linux Journal, January 2004,
+pages 74-77. This is \fBhttp://www.linuxjournal.com/article.php?sid=6983\fP
+online.
+
+If you would like to understand better how SMART works, and what it
+does, a good place to start is with Sections 4.8 and 6.54 of the first
+volume of the \'AT Attachment with Packet Interface-7\' (ATA/ATAPI-7)
+specification.  This documents the SMART functionality which the
+\fBsmartmontools\fP utilities provide access to.  You can find
+Revision 4b of this document at
+\fBhttp://www.t13.org/docs2004/d1532v1r4b-ATA-ATAPI-7.pdf\fP .
+Earlier and later versions of this Specification are available from
+the T13 web site \fBhttp://www.t13.org/\fP .
+
+.fi
+The functioning of SMART was originally defined by the SFF\-8035i
+revision 2 and the SFF\-8055i revision 1.4 specifications.  These are
+publications of the Small Form Factors (SFF) Committee.  Links to
+these documents may be found in the References section of the
+\fBsmartmontools\fP home page at
+\fBhttp://smartmontools.sourceforge.net/\fP .
+
+.SH
+CVS ID OF THIS PAGE:
+$Id: smartctl.8.in,v 1.83 2006/09/15 08:03:52 sxzzsf Exp $
+.\" Local Variables:            
+.\" mode: nroff         
+.\" End:
index 051824d8e7260a1e6133bae5739d50aed3bb2fe4..cb0d3dbf85d6169fe418c4bf3f8877b0aaf01998 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
 #include <unistd.h>
 #endif
 
+#if defined(__QNXNTO__) 
+#include <unistd.h>
+#endif
+
+
 #include "int64.h"
 #include "atacmds.h"
 #include "ataprint.h"
@@ -50,7 +55,7 @@
 extern const char *os_solaris_ata_s_cvsid;
 #endif
 extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *scsiprint_c_cvsid, *utility_c_cvsid;
-const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.156 2006/10/09 11:45:12 guidog Exp $"
+const char* smartctl_c_cvsid="$Id: smartctl.cpp,v 1.168 2007/11/13 14:53:27 jhering Exp $"
 ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID EXTERN_H_CVSID INT64_H_CVSID KNOWNDRIVES_H_CVSID SCSICMDS_H_CVSID SCSIPRINT_H_CVSID SMARTCTL_H_CVSID UTILITY_H_CVSID;
 
 // This is a block containing all the "control variables".  We declare
@@ -69,7 +74,7 @@ void printslogan(){
 #else
   const char * ver = SMARTMONTOOLS_BUILD_HOST;
 #endif
-  pout("smartctl version %s [%s] Copyright (C) 2002-6 Bruce Allen\n", PACKAGE_VERSION, ver);
+  pout("smartctl version %s [%s] Copyright (C) 2002-7 Bruce Allen\n", PACKAGE_VERSION, ver);
   pout("Home page is " PACKAGE_HOMEPAGE "\n\n");
   return;
 }
@@ -82,7 +87,7 @@ void PrintOneCVS(const char *a_cvs_id){
 }
 
 void printcopy(){
-  char *configargs=strlen(SMARTMONTOOLS_CONFIGURE_ARGS)?SMARTMONTOOLS_CONFIGURE_ARGS:"[no arguments given]";
+  const char *configargs=strlen(SMARTMONTOOLS_CONFIGURE_ARGS)?SMARTMONTOOLS_CONFIGURE_ARGS:"[no arguments given]";
 
   pout("smartctl comes with ABSOLUTELY NO WARRANTY. This\n");
   pout("is free software, and you are welcome to redistribute it\n");
@@ -141,7 +146,7 @@ void Usage (void){
 #ifdef HAVE_GETOPT_LONG
   printf(
 "  -q TYPE, --quietmode=TYPE                                           (ATA)\n"
-"         Set smartctl quiet mode to one of: errorsonly, silent\n\n"
+"         Set smartctl quiet mode to one of: errorsonly, silent, noserial\n\n"
 "  -d TYPE, --device=TYPE\n"
 "         Specify device type to one of: ata, scsi, marvell, sat, 3ware,N\n\n"
 "  -T TYPE, --tolerance=TYPE                                           (ATA)\n"
@@ -155,9 +160,10 @@ void Usage (void){
   );
 #else
   printf(
-"  -q TYPE   Set smartctl quiet mode to one of: errorsonly, silent     (ATA)\n"
+"  -q TYPE   Set smartctl quiet mode to one of: errorsonly, silent,    (ATA)\n"
+"                                               noserial\n"
 "  -d TYPE   Specify device type to one of: ata, scsi, 3ware,N\n"
-"  -T TYPE   Tolerance: normal, conservative,permissive,verypermissive (ATA\n"
+"  -T TYPE   Tolerance: normal, conservative,permissive,verypermissive (ATA)\n"
 "  -b TYPE   Set action on bad checksum to one of: warn, exit, ignore  (ATA)\n"
 "  -r TYPE   Report transactions (see man page)\n"
 "  -n MODE   No check if: never, sleep, standby, idle (see man page)   (ATA)\n\n"
@@ -191,11 +197,12 @@ void Usage (void){
 "        Show device SMART vendor-specific Attributes and values\n\n"
 "  -l TYPE, --log=TYPE\n"
 "        Show device log. TYPE: error, selftest, selective, directory,\n"
-"                               background\n\n"
+"                               background, scttemp[sts,hist]\n\n"
 "  -v N,OPTION , --vendorattribute=N,OPTION                            (ATA)\n"
 "        Set display OPTION for vendor Attribute N (see man page)\n\n"
 "  -F TYPE, --firmwarebug=TYPE                                         (ATA)\n"
-"        Use firmware bug workaround: none, samsung, samsung2\n\n"
+"        Use firmware bug workaround: none, samsung, samsung2,\n"
+"                                     samsung3, swapid\n\n"
 "  -P TYPE, --presets=TYPE                                             (ATA)\n"
 "        Drive-specific presets: use, ignore, show, showall\n\n"
   );
@@ -205,9 +212,10 @@ void Usage (void){
 "  -c        Show device SMART capabilities                             (ATA)\n"
 "  -A        Show device SMART vendor-specific Attributes and values    (ATA)\n"
 "  -l TYPE   Show device log. TYPE: error, selftest, selective, directory,\n"
-"                                   background\n"
+"                                   background, scttemp[sts,hist]\n"
 "  -v N,OPT  Set display OPTion for vendor Attribute N (see man page)   (ATA)\n"
-"  -F TYPE   Use firmware bug workaround: none, samsung, samsung2       (ATA)\n"
+"  -F TYPE   Use firmware bug workaround: none, samsung, samsung2,      (ATA)\n"
+"                                         samsung3, swapid\n"
 "  -P TYPE   Drive-specific presets: use, ignore, show, showall         (ATA)\n\n"
   );
 #endif
@@ -215,7 +223,8 @@ void Usage (void){
 #ifdef HAVE_GETOPT_LONG
   printf(
 "  -t TEST, --test=TEST\n"
-"        Run test.  TEST is: offline short long conveyance select,M-N pending,N afterselect,on afterselect,off\n\n"
+"        Run test. TEST: offline short long conveyance select,M-N\n"
+"                        pending,N afterselect,[on|off] scttempint,N[,p]\n\n"
 "  -C, --captive\n"
 "        Do test in captive mode (along with -t)\n\n"
 "  -X, --abort\n"
@@ -223,7 +232,8 @@ void Usage (void){
 );
 #else
   printf(
-"  -t TEST   Run test.  TEST is: offline short long conveyance select,M-N pending,N afterselect,on afterselect,off\n"
+"  -t TEST   Run test. TEST: offline short long conveyance select,M-N\n"
+"                            pending,N afterselect,[on|off] scttempint,N[,p]\n"
 "  -C        Do test in captive mode (along with -t)\n"
 "  -X        Abort any non-captive test\n\n"
   );
@@ -237,7 +247,7 @@ void Usage (void){
 const char *getvalidarglist(char opt) {
   switch (opt) {
   case 'q':
-    return "errorsonly, silent";
+    return "errorsonly, silent, noserial";
   case 'd':
     return "ata, scsi, marvell, sat, 3ware,N, hpt,L/M/N cciss,N";
   case 'T':
@@ -251,13 +261,13 @@ const char *getvalidarglist(char opt) {
   case 'S':
     return "on, off";
   case 'l':
-    return "error, selftest, selective, directory, background";
+    return "error, selftest, selective, directory, background, scttemp[sts|hist]";
   case 'P':
     return "use, ignore, show, showall";
   case 't':
-    return "offline, short, long, conveyance, select,M-N, pending,N, afterselect,on, afterselect,off";
+    return "offline, short, long, conveyance, select,M-N, pending,N, afterselect,[on|off], scttempint,N[,p]";
   case 'F':
-    return "none, samsung, samsung2";
+    return "none, samsung, samsung2, samsung3, swapid";
   case 'n':
     return "never, sleep, standby, idle";
   case 'v':
@@ -368,6 +378,8 @@ void ParseOpts (int argc, char** argv){
       } else if (!strcmp(optarg,"silent")) {
         con->printing_switchable     = FALSE;
         con->dont_print = TRUE;
+      } else if (!strcmp(optarg,"noserial")) {
+        con->dont_print_serial = TRUE;
       } else {
         badarg = TRUE;
       }
@@ -463,8 +475,8 @@ void ParseOpts (int argc, char** argv){
             if (split_report_arg2(s, &i)) {
                  sprintf(extraerror, "Option -d 3ware,N requires N to be a non-negative integer\n");
                  badarg = TRUE;
-            } else if (i<0 || i>15) {
-                 sprintf(extraerror, "Option -d 3ware,N (N=%d) must have 0 <= N <= 15\n", i);
+            } else if (i<0 || i>31) {
+                 sprintf(extraerror, "Option -d 3ware,N (N=%d) must have 0 <= N <= 31\n", i);
                  badarg = TRUE;
             } else {
                // NOTE: controller_port == disk number + 1
@@ -476,8 +488,8 @@ void ParseOpts (int argc, char** argv){
              if (split_report_arg2(s, &i)) {
                  sprintf(extraerror, "Option -d cciss,N requires N to be a non-negative integer\n");
                  badarg = TRUE;
-             } else if (i<0 || i>15) {
-                 sprintf(extraerror, "Option -d cciss,N (N=%d) must have 0 <= N <= 15\n", i);
+             } else if (i<0 || i>127) {
+                 sprintf(extraerror, "Option -d cciss,N (N=%d) must have 0 <= N <= 127\n", i);
                  badarg = TRUE;
              } else {
                // NOTE: controller_port == drive number
@@ -588,6 +600,10 @@ void ParseOpts (int argc, char** argv){
         con->fixfirmwarebug = FIX_SAMSUNG;
       } else if (!strcmp(optarg,"samsung2")) {
         con->fixfirmwarebug = FIX_SAMSUNG2;
+      } else if (!strcmp(optarg,"samsung3")) {
+        con->fixfirmwarebug = FIX_SAMSUNG3;
+      } else if (!strcmp(optarg,"swapid")) {
+        con->fixswappedid = TRUE;
       } else {
         badarg = TRUE;
       }
@@ -604,11 +620,17 @@ void ParseOpts (int argc, char** argv){
       } else if (!strcmp(optarg,"selftest")) {
         con->smartselftestlog = TRUE;
       } else if (!strcmp(optarg, "selective")) {
-       con->selectivetestlog = TRUE;
+        con->selectivetestlog = TRUE;
       } else if (!strcmp(optarg,"directory")) {
         con->smartlogdirectory = TRUE;
       } else if (!strcmp(optarg,"background")) {
         con->smartbackgroundlog = TRUE;
+      } else if (!strcmp(optarg,"scttemp")) {
+        con->scttempsts = con->scttemphist = TRUE;
+      } else if (!strcmp(optarg,"scttempsts")) {
+        con->scttempsts = TRUE;
+      } else if (!strcmp(optarg,"scttemphist")) {
+        con->scttemphist = TRUE;
       } else {
         badarg = TRUE;
       }
@@ -702,10 +724,9 @@ void ParseOpts (int argc, char** argv){
          con->pendingtime=i+1;
        }
       } else if (!strncmp(optarg,"select",strlen("select"))) {
-       // parse range of LBAs to test
-       uint64_t start, stop;
-
-        if (split_selective_arg(optarg, &start, &stop)) {
+        // parse range of LBAs to test
+        uint64_t start, stop; int mode;
+        if (split_selective_arg(optarg, &start, &stop, &mode)) {
          sprintf(extraerror, "Option -t select,M-N must have non-negative integer M and N\n");
           badarg = TRUE;
         } else {
@@ -721,9 +742,19 @@ void ParseOpts (int argc, char** argv){
           }
           con->smartselectivespan[con->smartselectivenumspans][0] = start;
           con->smartselectivespan[con->smartselectivenumspans][1] = stop;
+          con->smartselectivemode[con->smartselectivenumspans] = mode;
           con->smartselectivenumspans++;
           con->testcase            = SELECTIVE_SELF_TEST;
         }
+      } else if (!strncmp(optarg, "scttempint,", sizeof("scstempint,")-1)) {
+        unsigned interval = 0; int n1 = -1, n2 = -1, len = strlen(optarg);
+        if (!(   sscanf(optarg,"scttempint,%u%n,p%n", &interval, &n1, &n2) == 1
+              && 0 < interval && interval <= 0xffff && (n1 == len || n2 == len))) {
+            strcpy(extraerror, "Option -t scttempint,N[,p] must have positive integer N\n");
+            badarg = TRUE;
+        }
+        con->scttempint = interval;
+        con->scttempintp = (n2 == len);
       } else {
         badarg = TRUE;
       }
@@ -934,6 +965,16 @@ int main (int argc, char **argv){
 
   device = argv[argc-1];
 
+  // Device name "-": Parse "smartctl -r ataioctl,2 ..." output
+  if (!strcmp(device,"-")) {
+    if (con->controller_type != CONTROLLER_UNKNOWN) {
+      pout("Smartctl: -d option is not allowed in conjunction with device name \"-\".\n");
+      UsageSummary();
+      return FAILCMD;
+    }
+    con->controller_type = CONTROLLER_PARSEDEV;
+  }
+
   // If use has specified 3ware controller, determine which interface 
   if (con->controller_type == CONTROLLER_3WARE) {
     con->controller_type=guess_device_type(device);
@@ -976,7 +1017,10 @@ int main (int argc, char **argv){
   // present (e.g. with st).  Opening is retried O_RDONLY if read-only
   // media prevents opening O_RDWR (it cannot happen for scsi generic
   // devices, but it can for the others).
-  fd = deviceopen(device, mode);
+  if (con->controller_type != CONTROLLER_PARSEDEV)
+    fd = deviceopen(device, mode);
+  else
+    fd = parsedev_open(device);
   if (fd<0) {
     char errmsg[256];
     snprintf(errmsg,256,"Smartctl open device: %s failed",argv[argc-1]);
@@ -1008,5 +1052,10 @@ int main (int argc, char **argv){
     break;
   }
   
+  if (con->controller_type != CONTROLLER_PARSEDEV)
+    deviceclose(fd);
+  else
+    parsedev_close(fd);
+
   return retval;
 }
index 2423d9f9537f2000a9ee813f9e87e43f5f05166a..0b3708993f8149ab1fdd651abdd6eb48d14ce1e1 100644 (file)
@@ -1,7 +1,7 @@
 .ig
-Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  
-$Id: smartd.8.in,v 1.113 2006/12/20 07:30:43 sxzzsf Exp $
+$Id: smartd.8.in,v 1.120 2007/11/01 20:53:29 chrfranke 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
@@ -101,26 +101,21 @@ Examine all entries \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
 devices, and entries \fB"/dev/rmt/*"\fP for SCSI tape devices.
 .IP \fBDARWIN:\fP 9
 The IOService plane is scanned for ATA block storage devices.
-.IP \fBWINDOWS:\fP 9
-Examine all entries \fB"/dev/hd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]")
-for IDE/ATA devices on WinNT4/2000/XP, \fB"/dev/hd[a-d]"\fP
-(bitmask from "\\\\.\\SMARTVSD") for IDE/ATA devices on Win95/98/98SE/ME.
-Examines all entries \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices 
+.IP \fBWINDOWS\ 9x/ME\fP: 9
+Examine all entries \fB"/dev/hd[a-d]"\fP (bitmask
+from "\\\\.\\SMARTVSD") for IDE/ATA devices.
+Examine all entries \fB"/dev/scsi[0\-9][0\-f]"\fP for SCSI devices 
 on ASPI adapter 0\-9, ID 0\-15.
+.IP \fBWINDOWS\ NT4/2000/XP/2003/Vista\fP: 9
+Examine all entries \fB"/dev/sd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]")
+for IDE/(S)ATA and SCSI disk devices 
+
 If a 3ware 9000 controller is installed, examine all entries
-\fB"/dev/hdX,N"\fP for the first logical drive (\'unit\'
-\fB"/dev/hdX"\fP) and all physical disks (\'ports\' \fB",N"\fP)
+\fB"/dev/sdX,N"\fP for the first logical drive (\'unit\'
+\fB"/dev/sdX"\fP) and all physical disks (\'ports\' \fB",N"\fP)
 detected behind this controller. Same for a second controller if present.
-
-The following forms are not scanned for but can be given explicitly in the
-configuration file and only apply to WinNT4/2000/XP/2003. The
-form \fB"/dev/sd[a\-z]"\fP can be given for SCSI
-disks "\\\\.\\PhysicalDrive[0\-25]" (where "a" maps to "0"). Additionally
-the form \fB"/dev/pd[0\-255]"\fP can be given for SCSI
-disks "\\\\.\\PhysicalDrive[0\-255]". The form \fB"/dev/tape[0\-255]"\fP
-can be given for SCSI tape drives "\\\\.\\Tape[0\-255]".
 .IP \fBCYGWIN\fP: 9
-See "WINDOWS" above.
+See "WINDOWS NT4/2000/XP/2003/Vista" above.
 .IP \fBOS/2,eComStation\fP: 9
 Use the form \fB"/dev/hd[a\-z]"\fP for IDE/ATA devices.
 .PP
@@ -256,6 +251,16 @@ messages from the event viewer. Use \'\fBsyslogevt -r smartd\fP\'
 to register, \'\fBsyslogevt -u smartd\fP\' to unregister and
 \'\fBsyslogevt\fP\' for more help.
 
+.TP
+.B \-n, \-\-no\-fork
+Do not fork into background; this is useful when executed from modern
+init methods like initng, minit or supervise.
+
+On Cygwin, this allows running \fBsmartd\fP as service via cygrunsrv,
+see NOTES below.
+
+On Windows, this option is not available, use \'\-\-service\' instead.
+
 .TP
 .B \-p NAME, \-\-pidfile=NAME
 Writes pidfile \fINAME\fP containing the \fBsmartd\fP Process ID
@@ -352,8 +357,8 @@ equivalent.
 .B \-\-service
 Cygwin and Windows only: Enables \fBsmartd\fP to run as a Windows service.
 
-On Cygwin, this option simply prevents forking into background mode to
-allow running \fBsmartd\fP as service via cygrunsrv, see NOTES below.
+On Cygwin, this option is kept for backward compatibility only.
+It has the same effect as \'\-n, \-\-no\-fork\', see above.
 
 On Windows, this option enables the buildin service support.
 The option must be specified in the service command line as the first
@@ -671,10 +676,10 @@ controllers (using the Marvell rather than libata driver).
 
 .I 3ware,N
 \- the device consists of one or more ATA disks connected to a 3ware
-RAID controller. The non-negative integer N (in the range from 0 to 15
+RAID controller. The non-negative integer N (in the range from 0 to 31
 inclusive) denotes which disk on the controller is monitored.  In log
 files and email messages this disk will be identified as 3ware_disk_XX
-with XX in the range from 00 to 15 inclusive.
+with XX in the range from 00 to 31 inclusive.
 
 This Directive may at first appear confusing, because the 3ware
 controller is a SCSI device (such as /dev/sda) and should be listed as
@@ -944,6 +949,10 @@ interrupted to begin another test.
 \fBsmartd\fP will not attempt to run \fBany\fP type of test if another
 test was already started or run in the same hour.
 
+To avoid performance problems during system boot, \fBsmartd\fP will
+not attempt to run any scheduled tests following the very first
+device polling (unless \'\-q onecheck\' is specified).
+
 Each time a test is run, \fBsmartd\fP will log an entry to SYSLOG.
 You can use these or the '-q showtests' command-line option to verify
 that you constructed \fBREGEXP\fP correctly.  The matching order
@@ -1102,7 +1111,7 @@ is set to the argument of \-M exec, if present or else to \'mail\'
 is set to the device path (examples: /dev/hda, /dev/sdb).
 .IP \fBSMARTD_DEVICETYPE\fP 4
 is set to the device type (possible values: ata, scsi, 3ware,N, hpt,L/M/N).
-Here N=0,...,15 denotes the ATA disk behind a 3ware RAID controller and
+Here N=0,...,23 denotes the ATA disk behind a 3ware RAID controller and
 L/M/N denotes the SATA disk behind a HighPoint RocketRAID controller.
 .IP \fBSMARTD_DEVICESTRING\fP 4
 is set to the device description.  For SMARTD_DEVICETYPE of ata or
@@ -1411,6 +1420,12 @@ are (1) no self-test log printed, even though you have run self-tests;
 number of ATA errors reported is byte swapped.  Enabling this option
 tells \fBsmartd\fP to evaluate this quantity in byte-reversed order.
 
+.I samsung3
+\- Some Samsung disks (at least SP2514N with Firmware VF100\-37) report
+a self\-test still in progress with 0% remaining when the test was already
+completed. If this directive is specified, \fBsmartd\fP will not skip the
+next scheduled self\-test (see Directive \'\-s\' above) in this case.
+
 Note that an explicit \'\-F\' Directive will over-ride any preset
 values for \'\-F\' (see the \'\-P\' option below).
 
@@ -1950,4 +1965,4 @@ smartmontools home page at \fBhttp://smartmontools.sourceforge.net/#references\f
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartd.8.in,v 1.113 2006/12/20 07:30:43 sxzzsf Exp $
+$Id: smartd.8.in,v 1.120 2007/11/01 20:53:29 chrfranke Exp $
diff --git a/smartd.8.in.orig b/smartd.8.in.orig
new file mode 100644 (file)
index 0000000..907ccd5
--- /dev/null
@@ -0,0 +1,1932 @@
+.ig
+Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+$Id: smartd.8.in,v 1.106 2006/09/27 21:42:03 chrfranke 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 Software Foundation; either version 2, or (at your option)
+any later version.
+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.
+This code was originally developed as a Senior Thesis by Michael
+Cornwell 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 SMARTD 8 CURRENT_CVS_DATE CURRENT_CVS_VERSION CURRENT_CVS_DATE
+.SH NAME
+\fBsmartd\fP \- SMART Disk Monitoring Daemon
+
+.SH SYNOPSIS
+.B smartd [options]
+
+.SH FULL PATH
+.B /usr/local/sbin/smartd
+
+.SH PACKAGE VERSION
+CURRENT_CVS_VERSION released CURRENT_CVS_DATE at CURRENT_CVS_TIME
+
+.SH DESCRIPTION
+\fBsmartd\fP is a daemon that monitors the Self-Monitoring, Analysis
+and Reporting Technology (SMART) system built into many ATA-3 and
+later ATA, IDE and SCSI-3 hard drives. The purpose of SMART is to
+monitor the reliability of the hard drive and predict drive failures,
+and to carry out different types of drive self-tests.  This version of
+\fBsmartd\fP is compatible with ATA/ATAPI-7 and earlier standards (see
+\fBREFERENCES\fP below).
+
+\fBsmartd\fP will attempt to enable SMART monitoring on ATA devices
+(equivalent to \fBsmartctl -s on\fP) and polls these and SCSI devices
+every 30 minutes (configurable), logging SMART errors and changes of
+SMART Attributes via the SYSLOG interface.  The default location for
+these SYSLOG notifications and warnings is \fB/var/log/messages\fP.
+To change this default location, please see the \fB\'-l\'\fP
+command-line option described below.
+
+In addition to logging to a file, \fBsmartd\fP can also be configured
+to send email warnings if problems are detected.  Depending upon the
+type of problem, you may want to run self\-tests on the disk, back up
+the disk, replace the disk, or use a manufacturer\'s utility to force
+reallocation of bad or unreadable disk sectors.  If disk problems are
+detected, please see the \fBsmartctl\fP manual page and the
+\fBsmartmontools\fP web page/FAQ for further guidance.
+
+If you send a \fBUSR1\fP signal to \fBsmartd\fP it will immediately
+check the status of the disks, and then return to polling the disks
+every 30 minutes. See the \fB\'\-i\'\fP option below for additional
+details.
+
+\fBsmartd\fP can be configured at start-up using the configuration
+file \fB/usr/local/etc/smartd.conf\fP (Windows: \fB./smartd.conf\fP).
+If the configuration file is subsequently modified, \fBsmartd\fP
+can be told to re-read the configuration file by sending it a
+\fBHUP\fP signal, for example with the command:
+.fi
+\fBkillall -HUP smartd\fP.
+.fi
+(Windows: See NOTES below.)
+
+On startup, if \fBsmartd\fP finds a syntax error in the configuration
+file, it will print an error message and then exit. However if
+\fBsmartd\fP is already running, then is told with a \fBHUP\fP signal
+to re-read the configuration file, and then find a syntax error in
+this file, it will print an error message and then continue, ignoring
+the contents of the (faulty) configuration file, as if the \fBHUP\fP
+signal had never been received.
+
+When \fBsmartd\fP is running in debug mode, the \fBINT\fP signal
+(normally generated from a shell with CONTROL\-C) is treated in the
+same way as a \fBHUP\fP signal: it makes \fBsmartd\fP reload its
+configuration file. To exit \fBsmartd\fP use CONTROL-\e
+(Cygwin: 2x CONTROL\-C, Windows: CONTROL\-Break).
+
+On startup, in the absence of the configuration file
+\fB/usr/local/etc/smartd.conf\fP, the \fBsmartd\fP daemon first scans for all
+devices that support SMART.  The scanning is done as follows:
+.IP \fBLINUX:\fP 9
+Examine all entries \fB"/dev/hd[a-t]"\fP for IDE/ATA
+devices, and \fB"/dev/sd[a-z]"\fP for SCSI devices.
+.IP \fBFREEBSD:\fP 9
+Examine all entries \fB"/dev/ad[0-9]+"\fP for IDE/ATA
+devices and \fB"/dev/da[0-9]+"\fP for SCSI devices.
+.IP \fBNETBSD/OPENBSD:\fP 9
+Authoritative list of disk devices is obtained from sysctl 
+\'hw.disknames\'.
+.IP \fBSOLARIS:\fP 9
+Examine all entries \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
+devices, and entries \fB"/dev/rmt/*"\fP for SCSI tape devices.
+.IP \fBDARWIN:\fP 9
+The IOService plane is scanned for ATA block storage devices.
+.IP \fBWINDOWS:\fP 9
+Examine all entries \fB"/dev/hd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]")
+for IDE/ATA devices on WinNT4/2000/XP, \fB"/dev/hd[a-d]"\fP
+(bitmask from "\\\\.\\SMARTVSD") for IDE/ATA devices on Win95/98/98SE/ME,
+and \fB"/dev/scsi[0-9][0-7]"\fP (ASPI adapter 0-9, ID 0-7) for SCSI
+devices on all versions of Windows.
+If a 3ware 9000 controller is installed, examine all entries
+\fB"/dev/hdX,N"\fP for the first logical drive (\'unit\'
+\fB"/dev/hdX"\fP) and all physical disks (\'ports\' \fB",N"\fP)
+detected behind this controller. Same for a second controller if present.
+.IP \fBCYGWIN\fP: 9
+See "WINDOWS" above.
+.IP \fBOS/2,eComStation\fP: 9
+Use the form \fB"/dev/hd[a\-z]"\fP for IDE/ATA devices.
+.PP
+\fBsmartd\fP then monitors
+for \fIall\fP possible SMART errors (corresponding to the \fB\'\-a\'\fP
+Directive in the configuration file; see \fBCONFIGURATION FILE\fP
+below). 
+
+.SH 
+OPTIONS
+Long options are not supported on all systems.  Use \fB\'smartd
+\-h\'\fP to see the available options.
+.TP
+.B \-c FILE, \-\-configfile=FILE
+
+Read \fBsmartd\fP configuration Directives from FILE, instead of from
+the default location \fB/usr/local/etc/smartd.conf\fP (Windows: \fB./smartd.conf\fP).
+If FILE does \fBnot\fP exist, then \fBsmartd\fP will print an error
+message and exit with nonzero status.  Thus, \'\-c /usr/local/etc/smartd.conf\'
+can be used to verify the existence of the default configuration file.
+
+By using \'\-\' for FILE, the configuration is read from standard
+input. This is useful for commands like:
+.nf
+.B echo /dev/hdb \-m user@home \-M test | smartd \-c \- \-q onecheck
+.fi
+to perform quick and simple checks without a configuration file.
+
+.TP
+.B \-d, \-\-debug
+Runs \fBsmartd\fP in "debug" mode. In this mode, it displays status
+information to STDOUT rather than logging it to SYSLOG and does not
+\fBfork(2)\fP into the background and detach from the controlling
+terminal.  In this mode, \fBsmartd\fP also prints more verbose
+information about what it is doing than when operating in "daemon"
+mode. In this mode, the \fBQUIT\fP signal (normally generated from a
+terminal with CONTROL\-C) makes \fBsmartd\fP reload its configuration
+file.  Please use CONTROL-\e to exit
+(Cygwin: 2x CONTROL\-C, Windows: CONTROL\-Break).
+
+Windows only: The "debug" mode can be toggled by the command
+\fBsmartd sigusr2\fP. A new console for debug output is opened when
+debug mode is enabled.
+.TP
+.B \-D, \-\-showdirectives
+Prints a list (to STDOUT) of all the possible Directives which may
+appear in the configuration file /usr/local/etc/smartd.conf, and then exits.
+These Directives are also described later in this man page. They may
+appear in the configuration file following the device name.
+.TP
+.B \-h, \-\-help, \-\-usage
+Prints usage message to STDOUT and exits.
+.TP
+.B \-i N, \-\-interval=N
+Sets the interval between disk checks to \fIN\fP seconds, where
+\fIN\fP is a decimal integer.  The minimum allowed value is ten and
+the maximum is the largest positive integer that can be represented on
+your system (often 2^31-1).  The default is 1800 seconds.
+
+Note that the superuser can make \fBsmartd\fP check the status of the
+disks at any time by sending it the \fBSIGUSR1\fP signal, for example
+with the command:
+.nf
+.B kill -SIGUSR1 <pid>
+.fi
+where \fB<pid>\fP is the process id number of \fBsmartd\fP.  One may
+also use:
+.nf
+.B killall -USR1 smartd
+.fi
+for the same purpose.
+.fi
+(Windows: See NOTES below.)
+
+.TP
+.B \-l FACILITY, \-\-logfacility=FACILITY
+Uses syslog facility FACILITY to log the messages from \fBsmartd\fP.
+Here FACILITY is one of \fIlocal0\fP, \fIlocal1\fP, ..., \fIlocal7\fP,
+or \fIdaemon\fP [default].  If this command-line option is not used,
+then by default messages from \fBsmartd\fP are logged to the facility
+\fIdaemon\fP.
+
+If you would like to have \fBsmartd\fP messages logged somewhere other
+than the default \fB/var/log/messages\fP location, this can typically
+be accomplished with (for example) the following steps:
+.RS 7
+.IP \fB[1]\fP 4
+Modify the script that starts \fBsmartd\fP to include the \fBsmartd\fP
+command-line argument \'\-l local3\'.  This tells \fBsmartd\fP to log its
+messages to facility \fBlocal3\fP.
+.IP \fB[2]\fP 4
+Modify the \fBsyslogd\fP configuration file (typically
+\fB/etc/syslog.conf\fP) by adding a line of the form:
+.nf
+\fBlocal3.* /var/log/smartd.log\fP
+.fi
+This tells \fBsyslogd\fP to log all the messages from facility \fBlocal3\fP to
+the designated file: /var/log/smartd.log.
+.IP \fB[3]\fP 4
+Tell \fBsyslogd\fP to re-read its configuration file, typically by
+sending the \fBsyslogd\fP process a \fBSIGHUP\fP hang-up signal.
+.IP \fB[4]\fP 4
+Start (or restart) the \fBsmartd\fP daemon.
+.RE
+.\"  The following two lines are a workaround for a man2html bug.  Please leave them.
+.\" They define a non-existent option; useful because man2html can't correctly reset the margins.
+.TP
+.B \&
+For more detailed information, please refer to the man pages for
+\fBsyslog.conf\fP, \fBsyslogd\fP, and \fBsyslog\fP.  You may also want
+to modify the log rotation configuration files; see the man pages for
+\fBlogrotate\fP and examine your system\'s /etc/logrotate.conf file.
+
+Cygwin: Support for \fBsyslogd\fP as described above is available starting with Cygwin 1.5.15.
+On older releases or if no local \fBsyslogd\fP is running, the \'\-l\' option has no effect.
+In this case, all \fBsyslog\fP messages are written to Windows event log
+or to file \fBC:/CYGWIN_SYSLOG.TXT\fP if the event log is not available.
+
+Windows: Some \fBsyslog\fP functionality is implemented
+internally in \fBsmartd\fP as follows: If no \'\-l\' option
+(or \'\-l daemon\') is specified, messages are written to Windows
+event log or to file \fB./smartd.log\fP if event log is not available
+(Win9x/ME or access denied). By specifying other values of FACILITY,
+log output is redirected as follows:
+\'\-l local0\' to file \fB./smartd.log\fP,
+\'\-l local1\' to standard output (redirect with \'>\' to any file),
+\'\-l local2\' to standard error,
+\'\-l local[3-7]\': to file \fB./smartd[1-5].log\fP.
+
+When using the event log, the enclosed utility \fBsyslogevt.exe\fP
+should be registered as an event message file to avoid error
+messages from the event viewer. Use \'\fBsyslogevt -r smartd\fP\'
+to register, \'\fBsyslogevt -u smartd\fP\' to unregister and
+\'\fBsyslogevt\fP\' for more help.
+
+.TP
+.B \-p NAME, \-\-pidfile=NAME
+Writes pidfile \fINAME\fP containing the \fBsmartd\fP Process ID
+number (PID).  To avoid symlink attacks make sure the directory to
+which pidfile is written is only writable for root.  Without this
+option, or if the \-\-debug option is given, no PID file is written on
+startup.  If \fBsmartd\fP is killed with a maskable signal then the
+pidfile is removed.
+.TP
+.B \-q WHEN, \-\-quit=WHEN
+Specifies when, if ever, \fBsmartd\fP should exit.  The valid
+arguments are to this option are:
+
+.I nodev
+\- Exit if there are no devices to monitor, or if any errors are found
+at startup in the configuration file.  This is the default.
+
+.I errors
+\- Exit if there are no devices to monitor, or if any errors are found
+in the configuration file /usr/local/etc/smartd.conf at startup or whenever it
+is reloaded.
+
+.I nodevstartup
+\- Exit if there are no devices to monitor at startup.  But continue
+to run if no devices are found whenever the configuration file is
+reloaded.
+
+.I never
+\- Only exit if a fatal error occurs (no remaining system memory,
+invalid command line arguments). In this mode, even if there are no
+devices to monitor, or if the configuration file
+\fB/usr/local/etc/smartd.conf\fP has errors, \fBsmartd\fP will continue to run,
+waiting to load a configuration file listing valid devices.
+
+.I onecheck
+\- Start \fBsmartd\fP in debug mode, then register devices, then check
+device\'s SMART status once, and then exit with zero exit status if all
+of these steps worked correctly.
+
+This last option is intended for \'distribution-writers\' who want to
+create automated scripts to determine whether or not to automatically
+start up \fBsmartd\fP after installing smartmontools.  After starting
+\fBsmartd\fP with this command-line option, the distribution\'s install
+scripts should wait a reasonable length of time (say ten seconds).  If
+\fBsmartd\fP has not exited with zero status by that time, the script
+should send \fBsmartd\fP a SIGTERM or SIGKILL and assume that
+\fBsmartd\fP will not operate correctly on the host.  Conversely, if
+\fBsmartd\fP exits with zero status, then it is safe to run
+\fBsmartd\fP in normal daemon mode. If \fBsmartd\fP is unable to
+monitor any devices or encounters other problems then it will return
+with non-zero exit status.
+
+.I showtests
+\- Start \fBsmartd\fP in debug mode, then register devices, then write
+a list of future scheduled self tests to stdout, and then exit with zero
+exit status if all of these steps worked correctly.
+Device's SMART status is not checked.
+
+This option is intended to test whether the '-s REGEX' directives in
+smartd.conf will have the desired effect. The output lists the next test
+schedules, limited to 5 tests per type and device. This is followed by a
+summary of all tests of each device within the next 90 days.
+.TP
+.B \-r TYPE, \-\-report=TYPE
+Intended primarily to help
+.B smartmontools
+developers understand the behavior of
+.B smartmontools
+on non-conforming or poorly-conforming hardware.  This option reports
+details of
+\fBsmartd\fP
+transactions with the device.  The option can be used multiple times.
+When used just once, it shows a record of the ioctl() transactions
+with the device.  When used more than once, the detail of these ioctl()
+transactions are reported in greater detail.  The valid arguments to
+this option are:
+
+.I ioctl
+\- report all ioctl() transactions.
+
+.I ataioctl
+\- report only ioctl() transactions with ATA devices.
+
+.I scsiioctl
+\- report only ioctl() transactions with SCSI devices.
+
+Any argument may include a positive integer to specify the level of
+detail that should be reported.  The argument should be followed by a
+comma then the integer with no spaces.  For example, \fIataioctl,2\fP
+The default level is 1, so \'\-r ataioctl,1\' and \'\-r ataioctl\' are
+equivalent.
+
+.TP
+.B \-\-service
+Cygwin and Windows only: Enables \fBsmartd\fP to run as a Windows service.
+
+On Cygwin, this option simply prevents forking into background mode to
+allow running \fBsmartd\fP as service via cygrunsrv, see NOTES below.
+
+On Windows, this option enables the buildin service support.
+The option must be specified in the service command line as the first
+argument. It should not be used from console.
+See NOTES below for details.
+
+.TP
+.B \-V, \-\-version, \-\-license, \-\-copyright
+Prints license, copyright, and CVS version information onto
+STDOUT and then exits. Please include this information if you are
+reporting bugs, or have specific questions about the behavior of
+\fBsmartd\fP.
+
+.SH EXAMPLES
+
+.B
+smartd
+.fi
+Runs the daemon in forked mode. This is the normal way to run
+\fBsmartd\fP.
+Entries are logged to SYSLOG (by default
+.B /var/log/messages.)
+
+.B
+smartd -d -i 30
+.fi
+Run in foreground (debug) mode, checking the disk status
+every 30 seconds.
+
+.B
+smartd -q onecheck
+.fi
+Registers devices, and checks the status of the devices exactly
+once. The exit status (the bash
+.B $?
+variable) will be zero if all went well, and nonzero if no devices
+were detected or some other problem was encountered.
+
+.fi 
+Note that \fBsmartmontools\fP provides a start-up script in
+\fB/usr/local/etc/rc.d/init.d/smartd\fP which is responsible for starting and
+stopping the daemon via the normal init interface.  Using this script,
+you can start \fBsmartd\fP by giving the command:
+.nf
+.B /usr/local/etc/rc.d/init.d/smartd start
+.fi
+and stop it by using the command:
+.nf
+.B /usr/local/etc/rc.d/init.d/smartd stop
+
+.fi
+If you want \fBsmartd\fP to start running whenever your machine is
+booted, this can be enabled by using the command:
+.nf
+.B /sbin/chkconfig --add smartd
+.fi
+and disabled using the command:
+.nf
+.B /sbin/chkconfig --del smartd
+.fi
+
+.\" DO NOT MODIFY THIS OR THE FOLLOWING TWO LINES. THIS MATERIAL
+.\" IS AUTOMATICALLY INCLUDED IN THE FILE smartd.conf.5
+.\" STARTINCLUDE
+
+.SH CONFIGURATION FILE /usr/local/etc/smartd.conf
+In the absence of a configuration file, under Linux
+\fBsmartd\fP 
+will try to open the 20 ATA devices 
+.B /dev/hd[a-t] 
+and the 26 SCSI devices
+.B /dev/sd[a-z].
+Under FreeBSD, 
+\fBsmartd\fP
+will try to open all existing ATA devices (with entries in /dev)
+.B /dev/ad[0-9]+
+and all existing SCSI devices
+.B /dev/da[0-9]+.  
+Under NetBSD/OpenBSD, 
+\fBsmartd\fP
+will try to open all existing ATA devices (with entries in /dev)
+.B /dev/wd[0-9]+c
+and all existing SCSI devices
+.B /dev/sd[0-9]+c.
+Under Solaris \fBsmartd\fP will try to open all entries \fB"/dev/rdsk/c?t?d?s?"\fP for IDE/ATA and SCSI disk
+devices, and entries \fB"/dev/rmt/*"\fP for SCSI tape devices.
+Under Windows \fBsmartd\fP will try to open all entries \fB"/dev/hd[a-j]"\fP ("\\\\.\\PhysicalDrive[0-9]")
+for IDE/ATA devices on WinNT4/2000/XP, \fB"/dev/hd[a-d]"\fP
+(bitmask from "\\\\.\\SMARTVSD") for IDE/ATA devices on Win95/98/98SE/ME,
+and \fB"/dev/scsi[0-9][0-7]"\fP (ASPI adapter 0-9, ID 0-7) for SCSI
+devices on all versions of Windows.
+Under Darwin, \fBsmartd\fP will open any ATA block storage device.
+
+This can be annoying if you have an ATA or SCSI device that hangs or
+misbehaves when receiving SMART commands.  Even if this causes no
+problems, you may be annoyed by the string of error log messages about
+block-major devices that can\'t be found, and SCSI devices that can\'t
+be opened.
+
+One can avoid this problem, and gain more control over the types of
+events monitored by
+\fBsmartd\fP,
+by using the configuration file
+.B /usr/local/etc/smartd.conf.
+This file contains a list of devices to monitor, with one device per
+line.  An example file is included with the
+.B smartmontools
+distribution. You will find this sample configuration file in
+\fB/usr/local/share/doc/smartmontools-5.1/\fP. For security, the configuration file
+should not be writable by anyone but root. The syntax of the file is as
+follows:
+.IP \(bu 4
+There should be one device listed per line, although you may have
+lines that are entirely comments or white space.
+.IP \(bu 4
+Any text following a hash sign \'#\' and up to the end of the line is
+taken to be a comment, and ignored.
+.IP \(bu 4
+Lines may be continued by using a backslash \'\e\' as the last
+non-whitespace or non-comment item on a line.
+.IP \(bu 4
+Note: a line whose first character is a hash sign \'#\' is treated as
+a white-space blank line, \fBnot\fP as a non-existent line, and will
+\fBend\fP a continuation line.
+.PP 0
+.fi
+Here is an example configuration file.  It\'s for illustrative purposes
+only; please don\'t copy it onto your system without reading to the end
+of the
+.B DIRECTIVES
+Section below!
+
+.nf
+.B ################################################
+.B # This is an example smartd startup config file
+.B # /usr/local/etc/smartd.conf for monitoring three
+.B # ATA disks, three SCSI disks, six ATA disks
+.B # behind two 3ware controllers, three SATA disks
+.B # directly connected to the highpoint rocket-
+.B # raid controller, two SATA disks connected to
+.B # the highpoint controller via a pmport device
+.B # and one SATA disk.
+.B #
+.nf
+.B # First ATA disk on two different interfaces. On
+.B # the second disk, start a long self-test every
+.B # Sunday between 3 and 4 am.
+.B #
+.B \ \ /dev/hda -a -m admin@example.com,root@localhost 
+.B \ \ /dev/hdc -a -I 194 -I 5 -i 12 -s L/../../7/03
+.B #
+.nf
+.B # SCSI disks.  Send a TEST warning email to admin on
+.B # startup.
+.B #
+.B \ \ /dev/sda
+.B \ \ /dev/sdb -m admin@example.com -M test
+.B #
+.nf
+.B # Strange device.  It\'s SCSI. Start a scheduled
+.B # long self test between 5 and 6 am Monday/Thursday
+.B \ \ /dev/weird -d scsi -s L/../../(1|4)/05
+.B #
+.nf
+.B # Linux-specific: SATA disk using the libata
+.B # driver.  This requires a 2.6.15 or greater
+.B # kernel.  The device entry is SCSI but the
+.B # underlying disk understands ATA SMART commands
+.B \ \ /dev/sda -a -d ata
+.B #
+.nf
+.B # Four ATA disks on a 3ware 6/7/8000 controller.
+.B # Start short self-tests daily between midnight and 1am,
+.B # 1-2, 2-3, and 3-4 am.  Starting with the Linux 2.6
+.B # kernel series, /dev/sdX is deprecated in favor of
+.B # /dev/tweN.  For example replace /dev/sdc by /dev/twe0
+.B # and /dev/sdd by /dev/twe1.
+.B \ \ /dev/sdc -d 3ware,0 -a -s S/../.././00
+.B \ \ /dev/sdc -d 3ware,1 -a -s S/../.././01
+.B \ \ /dev/sdd -d 3ware,2 -a -s S/../.././02
+.B \ \ /dev/sdd -d 3ware,3 -a -s S/../.././03
+.B #
+.nf
+.B # Two ATA disks on a 3ware 9000 controller.
+.B # Start long self-tests Sundays between  midnight and 
+.B # 1am and 2-3 am
+.B \ \ /dev/twa0 -d 3ware,0 -a -s L/../../7/00
+.B \ \ /dev/twa0 -d 3ware,1 -a -s L/../../7/02
+.B #
+.nf
+.B # Three SATA disks on a highpoint rocketraid controller.
+.B # Start short self-tests daily between 1-2, 2-3, and
+.B # 3-4 am.
+.B \ \ /dev/sde -d hpt,1/1 -a -s S/../.././01
+.B \ \ /dev/sde -d hpt,1/2 -a -s S/../.././02
+.B \ \ /dev/sde -d hpt,1/3 -a -s S/../.././03
+.B #
+.nf
+.B # Two SATA disks connected to a highpoint rocketraid 
+.B # via a pmport device.  Start long self-tests Sundays
+.B # between midnight and 1am and 2-3 am
+.B \ \ /dev/sde -d hpt,1/4/1 -a -s L/../../7/00
+.B \ \ /dev/sde -d hpt,1/4/2 -a -s L/../../7/02
+.B #
+.nf
+.B # The following line enables monitoring of the 
+.B # ATA Error Log and the Self-Test Error Log.  
+.B # It also tracks changes in both Prefailure
+.B # and Usage Attributes, apart from Attributes
+.B # 9, 194, and 231, and shows  continued lines:
+.B #
+.B \ \ /dev/hdd\ -l\ error\ \e
+.B \ \ \ \ \ \ \ \ \ \ \ -l\ selftest\ \e
+.B \ \ \ \ \ \ \ \ \ \ \ -t\ \e\ \ \ \ \ \ # Attributes not tracked:
+.B \ \ \ \ \ \ \ \ \ \ \ -I\ 194\ \e\ \ # temperature
+.B \ \ \ \ \ \ \ \ \ \ \ -I\ 231\ \e\ \ # also temperature
+.B \ \ \ \ \ \ \ \ \ \ \ -I 9\ \ \ \ \ \ # power-on hours
+.B #
+.B ################################################
+.fi
+
+.PP 
+.SH CONFIGURATION FILE DIRECTIVES
+.PP
+
+If the first non-comment entry in the configuration file is the text
+string
+.B DEVICESCAN
+in capital letters, then
+\fBsmartd\fP
+will ignore any remaining lines in the configuration file, and will
+scan for devices.
+.B DEVICESCAN
+may optionally be followed by Directives that will apply to all
+devices that are found in the scan.  Please see below for additional
+details.
+
+.sp 2
+The following are the Directives that may appear following the device
+name or
+.B DEVICESCAN
+on any line of the
+.B /usr/local/etc/smartd.conf
+configuration file. Note that
+.B these are NOT command-line options for 
+\fBsmartd\fP.
+The Directives below may appear in any order, following the device
+name. 
+
+.B For an ATA device,
+if no Directives appear, then the device will be monitored
+as if the \'\-a\' Directive (monitor all SMART properties) had been given.
+
+.B If a SCSI disk is listed,
+it will be monitored at the maximum implemented level: roughly
+equivalent to using the \'\-H \-l selftest\' options for an ATA disk.
+So with the exception of \'\-d\', \'\-m\', \'\-l selftest\', \'\-s\', and
+\'\-M\', the Directives below are ignored for SCSI disks.  For SCSI
+disks, the \'\-m\' Directive sends a warning email if the SMART status
+indicates a disk failure or problem, if the SCSI inquiry about disk
+status fails, or if new errors appear in the self-test log.
+
+.B If a 3ware controller is used
+then the corresponding SCSI (/dev/sd?) or character device (/dev/twe?
+or /dev/twa?) must be listed, along with the \'\-d 3ware,N\' Directive
+(see below).  The individual ATA disks hosted by the 3ware controller
+appear to \fBsmartd\fP as normal ATA devices.  Hence all the ATA
+directives can be used for these disks (but see note below).
+
+.TP
+.B \-d TYPE
+Specifies the type of the device.  This Directive may be used multiple
+times for one device, but the arguments \fIata\fP, \fIscsi\fP, \fIsat\fP,
+\fImarvell\fP, and \fI3ware,N\fP are mutually-exclusive. If more than
+one is given then \fBsmartd\fP will use the last one which appears.
+
+If none of these three arguments is given, then \fBsmartd\fP will
+first attempt to guess the device type by looking at whether the sixth
+character in the device name is an \'s\' or an \'h\'.  This will work for
+device names like /dev/hda or /dev/sdb, and corresponds to choosing
+\fIata\fP or \fIscsi\fP respectively. If
+\fBsmartd\fP
+can\'t guess from this sixth character, then it will simply try to
+access the device using first ATA and then SCSI ioctl()s.
+
+The valid arguments to this Directive are:
+
+.I ata
+\- the device type is ATA.  This prevents
+\fBsmartd\fP
+from issuing SCSI commands to an ATA device.
+
+.I scsi
+\- the device type is SCSI.  This prevents
+\fBsmartd\fP
+from issuing ATA commands to a SCSI device.
+
+.I sat
+\- the device type is SCSI to ATA Translation (SAT).
+\fBsmartd\fP
+will generate ATA (smart) commands and then package them in
+the SAT defined ATA PASS THROUGH SCSI commands. The commands
+are then routed through the SCSI pass through interface to the
+operating system. There are two types of ATA PASS THROUGH
+SCSI commands: a 12 byte and 16 byte variant.
+\fBsmartd\fP
+can use either and defaults to the 16 byte variant. This can
+be overridden with this syntax: \'\-d sat,12\' or \'\-d sat,16\'.
+
+.I marvell
+\- Under Linux, interact with SATA disks behind Marvell chip-set
+controllers (using the Marvell rather than libata driver).
+
+.I 3ware,N
+\- the device consists of one or more ATA disks connected to a 3ware
+RAID controller. The non-negative integer N (in the range from 0 to 15
+inclusive) denotes which disk on the controller is monitored.  In log
+files and email messages this disk will be identified as 3ware_disk_XX
+with XX in the range from 00 to 15 inclusive.
+
+This Directive may at first appear confusing, because the 3ware
+controller is a SCSI device (such as /dev/sda) and should be listed as
+such in the the configuration file.
+However when the \'\-d 3ware,N\'
+Directive is used, then the corresponding disk is addressed using
+native ATA commands which are \'passed through\' the SCSI driver. All
+ATA Directives listed in this man page may be used.  Note that while
+you may use \fBany\fP of the 3ware SCSI logical devices /dev/sd? to
+address \fBany\fP of the physical disks (3ware ports), error and log
+messages will make the most sense if you always list the 3ware SCSI
+logical device corresponding to the particular physical disks.  Please
+see the \fBsmartctl\fP man page for further details.
+
+ATA disks behind 3ware controllers may alternatively be accessed via a
+character device interface /dev/twe0-15 (3ware 6000/7000/8000
+controllers) and /dev/twa0-15 (3ware 9000 series controllers).  Note
+that the 9000 series controllers may \fBonly\fP be accessed using the
+character device interface /dev/twa0-15 and not the SCSI device
+interface /dev/sd?.  Please see the \fBsmartctl\fP man page for
+further details.
+
+Note that older 3w-xxxx drivers do not pass the \'Enable Autosave\'
+(\fB-S on\fP) and \'Enable Automatic Offline\' (\fB-o on\fP) commands
+to the disk, if the SCSI interface is used, and produce these types of
+harmless syslog error messages instead: \fB\'3w-xxxx: tw_ioctl():
+Passthru size (123392) too big\'\fP. This can be fixed by upgrading to
+version 1.02.00.037 or later of the 3w-xxxx driver, or by applying a
+patch to older versions.  See
+\fBhttp://smartmontools.sourceforge.net/\fP for instructions.
+Alternatively use the character device interfaces /dev/twe0-15 (3ware
+6/7/8000 series controllers) or /dev/twa0-15 (3ware 9000 series
+controllers).
+
+
+.B 3ware controllers are currently ONLY supported under Linux.
+
+.I hpt,L/M/N
+\- the device consists of one or more ATA disks connected to a HighPoint
+RocketRAID controller. The integer L is the controller id, the integer M
+is the channel number, and the integer N is the PMPort number if it is
+available. The allowed values of L are from 1 to 4 inclusive, M are from
+1 to 8 inclusive and N from 1 to 4 if PMPort available.  And also these
+values are limited by the model of the HighPoint RocketRAID controller.
+In log files and email messages this disk will be identified as
+hpt_X/X/X and X/X/X is the same as L/M/N, note if no N indicated, N set
+to the default value 1.
+
+.B HighPoint RocketRAID controllers are currently ONLY supported under Linux.
+
+.I removable
+\- the device or its media is removable.  This indicates to
+\fBsmartd\fP
+that it should continue (instead of exiting, which is the default
+behavior) if the device does not appear to be present when
+\fBsmartd\fP is started.  This Directive may be used in conjunction
+with the other \'\-d\' Directives.
+
+.TP
+.B \-n POWERMODE[,q]
+This \'nocheck\' Directive is used to prevent a disk from being
+spun-up when it is periodically polled by \fBsmartd\fP.
+
+ATA disks have five different power states. In order of increasing
+power consumption they are: \'OFF\', \'SLEEP\', \'STANDBY\', \'IDLE\',
+and \'ACTIVE\'.  Typically in the OFF, SLEEP, and STANDBY modes the
+disk\'s platters are not spinning. But usually, in response to SMART
+commands issued by \fBsmartd\fP, the disk platters are spun up.  So if
+this option is not used, then a disk which is in a low\-power mode may
+be spun up and put into a higher\-power mode when it is periodically
+polled by \fBsmartd\fP.
+
+Note that if the disk is in SLEEP mode when \fBsmartd\fP is started,
+then it won't respond to \fBsmartd\fP commands, and so the disk won't
+be registered as a device for \fBsmartd\fP to monitor. If a disk is in
+any other low\-power mode, then the commands issued by \fBsmartd\fP to
+register the disk will probably cause it to spin\-up.
+
+The \'\fB\-n\fP\' (nocheck) Directive specifies if \fBsmartd\fP\'s
+periodic checks should still be carried out when the device is in a
+low\-power mode.  It may be used to prevent a disk from being spun\-up
+by periodic \fBsmartd\fP polling.  The allowed values of POWERMODE
+are:
+
+.I never
+\- \fBsmartd\fP will poll (check) the device regardless of its power
+mode. This may cause a disk which is spun\-down to be spun\-up when
+\fBsmartd\fP checks it.  This is the default behavior if the '\-n'
+Directive is not given.
+
+.I sleep
+\- check the device unless it is in SLEEP mode.
+
+.I standby
+\- check the device unless it is in SLEEP or STANDBY mode.  In
+these modes most disks are not spinning, so if you want to prevent
+a laptop disk from spinning up each time that \fBsmartd\fP polls,
+this is probably what you want.
+
+.I idle
+\- check the device unless it is in SLEEP, STANDBY or IDLE mode.
+In the IDLE state, most disks are still spinning, so this is probably
+not what you want.
+
+When a self test is scheduled (see \'\-s\' Directive below), the
+\'\fB\-n\fP\' Directive is ignored, and all tests are carried out.
+
+When a periodic test is skipped, \fBsmartd\fP normally writes an
+informal log message. The message can be suppressed by appending
+the option \',q\' to POWERMODE (like \'\-n standby,q\').
+This prevents a laptop disk from spinning up due to this message.
+
+.TP
+.B \-T TYPE
+Specifies how tolerant
+\fBsmartd\fP
+should be of SMART command failures.  The valid arguments to this
+Directive are:
+
+.I normal
+\- do not try to monitor the disk if a mandatory SMART command fails, but
+continue if an optional SMART command fails.  This is the default.
+
+.I permissive
+\- try to monitor the disk even if it appears to lack SMART
+capabilities.  This may be required for some old disks (prior to
+ATA\-3 revision 4) that implemented SMART before the SMART standards
+were incorporated into the ATA/ATAPI Specifications.  This may also be
+needed for some Maxtor disks which fail to comply with the ATA
+Specifications and don't properly indicate support for error\- or
+self\-test logging.
+
+[Please see the \fBsmartctl \-T\fP command-line option.]
+.TP
+.B \-o VALUE
+Enables or disables SMART Automatic Offline Testing when
+\fBsmartd\fP
+starts up and has no further effect.  The valid arguments to this
+Directive are \fIon\fP and \fIoff\fP.
+
+The delay between tests is vendor-specific, but is typically four
+hours.
+
+Note that SMART Automatic Offline Testing is \fBnot\fP part of the ATA
+Specification.  Please see the
+.B smartctl \-o
+command-line option documentation for further information about this
+feature.
+.TP
+.B \-S VALUE
+Enables or disables Attribute Autosave when \fBsmartd\fP
+starts up and has no further effect.  The valid arguments to this
+Directive are \fIon\fP and \fIoff\fP.  Also affects SCSI devices.
+[Please see the \fBsmartctl \-S\fP command-line option.]
+.TP
+.B \-H
+Check the SMART health status of the disk.  If any Prefailure
+Attributes are less than or equal to their threshold values, then disk
+failure is predicted in less than 24 hours, and a message at loglevel
+.B \'LOG_CRITICAL\'
+will be logged to syslog.  [Please see the
+.B smartctl \-H
+command-line option.]
+.TP
+.B \-l TYPE
+Reports increases in the number of errors in one of the two SMART logs.  The
+valid arguments to this Directive are:
+
+.I error
+\- report if the number of ATA errors reported in the ATA Error Log
+has increased since the last check.
+
+.I selftest
+\- report if the number of failed tests reported in the SMART
+Self-Test Log has increased since the last check, or if the timestamp
+associated with the most recent failed test has increased.  Note that
+such errors will \fBonly\fP be logged if you run self-tests on the
+disk (and it fails a test!).  Self-Tests can be run automatically by
+\fBsmartd\fP: please see the \fB\'\-s\'\fP Directive below.
+Self-Tests can also be run manually by using the \fB\'\-t\ short\'\fP
+and \fB\'\-t\ long\'\fP options of \fBsmartctl\fP and the results of
+the testing can be observed using the \fBsmartctl \'\-l\ selftest\'\fP
+command-line option.]
+
+[Please see the \fBsmartctl \-l\fP and \fB\-t\fP command-line
+options.]
+.TP
+.B \-s REGEXP
+Run Self-Tests or Offline Immediate Tests, at scheduled times.  A
+Self- or Offline Immediate Test will be run at the end of periodic
+device polling, if all 12 characters of the string \fBT/MM/DD/d/HH\fP
+match the extended regular expression \fBREGEXP\fP. Here:
+.RS 7
+.IP \fBT\fP 4
+is the type of the test.  The values that \fBsmartd\fP will try to
+match (in turn) are: \'L\' for a \fBL\fPong Self-Test, \'S\' for a
+\fBS\fPhort Self-Test, \'C\' for a \fBC\fPonveyance Self-Test (ATA
+only), and \'O\' for an \fBO\fPffline Immediate Test (ATA only).  As
+soon as a match is found, the test will be started and no additional
+matches will be sought for that device and that polling cycle.
+.IP \fBMM\fP 4
+is the month of the year, expressed with two decimal digits.  The
+range is from 01 (January) to 12 (December) inclusive.  Do \fBnot\fP
+use a single decimal digit or the match will always fail!
+.IP \fBDD\fP 4
+is the day of the month, expressed with two decimal digits. The
+range is from 01 to 31 inclusive.  Do \fBnot\fP
+use a single decimal digit or the match will always fail!
+.IP \fBd\fP 4
+is the day of the week, expressed with one decimal digit.  The
+range is from 1 (Monday) to 7 (Sunday) inclusive.
+.IP \fBHH\fP 4
+is the hour of the day, written with two decimal digits, and given in
+hours after midnight.  The range is 00 (midnight to just before 1am)
+to 23 (11pm to just before midnight) inclusive.  Do \fBnot\fP use a
+single decimal digit or the match will always fail!
+.RE
+.\"  The following two lines are a workaround for a man2html bug.  Please leave them.
+.\" They define a non-existent option; useful because man2html can't correctly reset the margins.
+.TP
+.B \&
+Some examples follow.  In reading these, keep in mind that in extended
+regular expressions a dot \fB\'.\'\fP matches any single character, and
+a parenthetical expression such as \fB\'(A|B|C)\'\fP denotes any one of the three possibilities \fBA\fP,
+\fBB\fP, or \fBC\fP.
+
+To schedule a short Self-Test between 2-3am every morning, use:
+.nf
+\fB \-s S/../.././02\fP
+.fi
+To schedule a long Self-Test between 4-5am every Sunday morning, use:
+.nf
+\fB \-s L/../../7/04\fP
+.fi
+To schedule a long Self-Test between 10-11pm on the first and
+fifteenth day of each month, use:
+.nf
+\fB \-s L/../(01|15)/./22\fP
+.fi
+To schedule an Offline Immediate test after every midnight, 6am,
+noon,and 6pm, plus a Short Self-Test daily at 1-2am and a Long
+Self-Test every Saturday at 3-4am, use:
+.nf
+\fB \-s (O/../.././(00|06|12|18)|S/../.././01|L/../../6/03)\fP
+.fi
+
+Scheduled tests are run immediately following the regularly-scheduled
+device polling, if the current local date, time, and test type, match
+\fBREGEXP\fP.  By default the regularly-scheduled device polling
+occurs every thirty minutes after starting \fBsmartd\fP.  Take caution
+if you use the \'\-i\' option to make this polling interval more than
+sixty minutes: the poll times may fail to coincide with any of the
+testing times that you have specified with \fBREGEXP\fP, and so the
+self tests may not take place as you wish.
+
+Before running an offline or self-test, \fBsmartd\fP checks to be sure
+that a self-test is not already running.  If a self-test \fBis\fP
+already running, then this running self test will \fBnot\fP be
+interrupted to begin another test.
+
+\fBsmartd\fP will not attempt to run \fBany\fP type of test if another
+test was already started or run in the same hour.
+
+Each time a test is run, \fBsmartd\fP will log an entry to SYSLOG.
+You can use these or the '-q showtests' command-line option to verify
+that you constructed \fBREGEXP\fP correctly.  The matching order
+(\fBL\fP before \fBS\fP before \fBC\fP before \fBO\fP) ensures that
+if multiple test types are all scheduled for the same hour, the
+longer test type has precedence.  This is usually the desired behavior.
+
+Unix users: please beware that the rules for extended regular
+expressions [regex(7)] are \fBnot\fP the same as the rules for
+file\-name pattern matching by the shell [glob(7)].  \fBsmartd\fP will
+issue harmless informational warning messages if it detects characters
+in \fBREGEXP\fP that appear to indicate that you have made this
+mistake.
+
+.TP
+.B \-m ADD
+Send a warning email to the email address \fBADD\fP if the \'\-H\',
+\'\-l\', \'\-f\', \'\-C\', or \'\-O\' Directives detect a failure or a
+new error, or if a SMART command to the disk fails. This Directive
+only works in conjunction with these other Directives (or with the
+equivalent default \'\-a\' Directive).
+
+To prevent your email in-box from getting filled up with warning
+messages, by default only a single warning will be sent for each of
+the enabled alert types, \'\-H\', \'\-l\', \'\-f\', \'\-C\', or
+\'\-O\' even if more than one failure or error is detected or if the
+failure or error persists.  [This behavior can be modified; see the
+\'\-M\' Directive below.]
+
+To send email to more than one user, please use the following "comma
+separated" form for the address: \fBuser1@add1,user2@add2,...,userN@addN\fP
+(with no spaces).
+
+To test that email is being sent correctly, use the \'\-M test\'
+Directive described below to send one test email message on
+\fBsmartd\fP
+startup.
+
+By default, email is sent using the system 
+.B mail
+command.  In order that
+\fBsmartd\fP
+find the mail command (normally /bin/mail) an executable named
+.B \'mail\'
+must be in the path of the shell or environment from which
+\fBsmartd\fP
+was started.  If you wish to specify an explicit path to the mail
+executable (for example /usr/local/bin/mail) or a custom script to
+run, please use the \'\-M exec\' Directive below.
+
+Note that by default under Solaris, in the previous paragraph,
+\'\fBmailx\fP\' and \'\fB/bin/mailx\fP\' are used, since Solaris
+\'/bin/mail\' does not accept a \'\-s\' (Subject) command-line
+argument.
+
+On Windows, the \'\fBBlat\fP\' mailer
+(\fBhttp://blat.sourceforge.net/\fP) is used by default.
+This mailer uses a different command line syntax, see
+\'\-M exec\' below.
+
+Note also that there is a special argument
+.B <nomailer>
+which can be given to the \'\-m\' Directive in conjunction with the \'\-M
+exec\' Directive. Please see below for an explanation of its effect.
+
+If the mailer or the shell running it produces any STDERR/STDOUT
+output, then a snippet of that output will be copied to SYSLOG.  The
+remainder of the output is discarded. If problems are encountered in
+sending mail, this should help you to understand and fix them.  If
+you have mail problems, we recommend running \fBsmartd\fP in debug
+mode with the \'-d\' flag, using the \'-M test\' Directive described
+below.
+
+The following extension is available on Windows:
+By specifying \'\fBmsgbox\fP\' as a mail address, a warning
+"email" is displayed as a message box on the screen.
+Using both \'\fBmsgbox\fP\' and regular mail addresses is possible,
+if \'\fBmsgbox\fP\' is the first word in the comma separated list.
+With \'\fBsysmsgbox\fP\', a system modal (always on top) message box
+is used. If running as a service, a service notification message box
+(always shown on current visible desktop) is used.
+
+.TP
+.B \-M TYPE
+These Directives modify the behavior of the
+\fBsmartd\fP
+email warnings enabled with the \'\-m\' email Directive described above.
+These \'\-M\' Directives only work in conjunction with the \'\-m\'
+Directive and can not be used without it.
+
+Multiple \-M Directives may be given.  If more than one of the
+following three \-M Directives are given (example: \-M once \-M daily)
+then the final one (in the example, \-M daily) is used.
+
+The valid arguments to the \-M Directive are (one of the following
+three):
+
+.I once
+\- send only one warning email for each type of disk problem detected.  This
+is the default.
+
+.I daily
+\- send additional warning reminder emails, once per day, for each type
+of disk problem detected.
+
+.I diminishing
+\- send additional warning reminder emails, after a one-day interval,
+then a two-day interval, then a four-day interval, and so on for each
+type of disk problem detected. Each interval is twice as long as the
+previous interval.
+
+In addition, one may add zero or more of the following Directives:
+
+.I test
+\- send a single test email
+immediately upon
+\fBsmartd\fP
+startup.  This allows one to verify that email is delivered correctly.
+
+.I exec PATH
+\- run the executable PATH instead of the default mail command, when
+\fBsmartd\fP
+needs to send email.  PATH must point to an executable binary file or
+script.
+
+By setting PATH to point to a customized script, you can make
+\fBsmartd\fP perform useful tricks when a disk problem is detected
+(beeping the console, shutting down the machine, broadcasting warnings
+to all logged-in users, etc.)  But please be careful. \fBsmartd\fP
+will \fBblock\fP until the executable PATH returns, so if your
+executable hangs, then \fBsmartd\fP will also hang. Some sample
+scripts are included in
+/usr/local/share/doc/smartmontools-5.1/examplescripts/.
+
+The return status of the executable is recorded by \fBsmartd\fP in
+SYSLOG. The executable is not expected to write to STDOUT or
+STDERR.  If it does, then this is interpreted as indicating that
+something is going wrong with your executable, and a fragment of this
+output is logged to SYSLOG to help you to understand the problem.
+Normally, if you wish to leave some record behind, the executable
+should send mail or write to a file or device.
+
+Before running the executable, \fBsmartd\fP sets a number of
+environment variables.  These environment variables may be used to
+control the executable\'s behavior.  The environment variables
+exported by \fBsmartd\fP are:
+.RS 7
+.IP \fBSMARTD_MAILER\fP 4
+is set to the argument of \-M exec, if present or else to \'mail\'
+(examples: /bin/mail, mail).
+.IP \fBSMARTD_DEVICE\fP 4
+is set to the device path (examples: /dev/hda, /dev/sdb).
+.IP \fBSMARTD_DEVICETYPE\fP 4
+is set to the device type (possible values: ata, scsi, 3ware,N, hpt,L/M/N).
+Here N=0,...,15 denotes the ATA disk behind a 3ware RAID controller and
+L/M/N denotes the SATA disk behind a HighPoint RocketRAID controller.
+.IP \fBSMARTD_DEVICESTRING\fP 4
+is set to the device description.  For SMARTD_DEVICETYPE of ata or
+scsi, this is the same as SMARTD_DEVICE.  For 3ware RAID controllers,
+the form used is \'/dev/sdc [3ware_disk_01]\'.  For HighPoint RocketRAID
+controller, the form is \'/dev/sdd [hpt_1/1/1]\'.  In these cases the
+device string contains a space and is NOT quoted.  So to use
+$SMARTD_DEVICESTRING in a bash script you should probably enclose it
+in double quotes.
+.IP \fBSMARTD_FAILTYPE\fP 4
+gives the reason for the warning or message email.  The possible values that
+it takes and their meanings are:
+.nf
+.fi
+\fIEmailTest\fP: this is an email test message.
+.nf
+.fi
+\fIHealth\fP: the SMART health status indicates imminent failure.
+.nf
+.fi
+\fIUsage\fP: a usage Attribute has failed.
+.nf
+.fi
+\fISelfTest\fP: the number of self-test failures has increased.
+.nf
+.fi
+\fIErrorCount\fP: the number of errors in the ATA error log has increased.
+.nf
+.fi
+\fICurrentPendingSector\fP: one of more disk sectors could not be
+read and are marked to be reallocated (replaced with spare sectors).
+.nf
+.fi
+\fIOfflineUncorrectableSector\fP: during off\-line testing, or self\-testing,
+one or more disk sectors could not be read.
+.nf
+.fi
+\fIFailedHealthCheck\fP: the SMART health status command failed.
+.nf
+.fi
+\fIFailedReadSmartData\fP: the command to read SMART Attribute data failed.
+.nf
+.fi
+\fIFailedReadSmartErrorLog\fP: the command to read the SMART error log failed.
+.nf
+.fi
+\fIFailedReadSmartSelfTestLog\fP: the command to read the SMART self-test log failed.
+.nf
+.fi
+\fIFailedOpenDevice\fP: the open() command to the device failed.
+.IP \fBSMARTD_ADDRESS\fP 4
+is determined by the address argument ADD of the \'\-m\' Directive.
+If ADD is \fB<nomailer>\fP, then \fBSMARTD_ADDRESS\fP is not set.
+Otherwise, it is set to the comma-separated-list of email addresses
+given by the argument ADD, with the commas replaced by spaces
+(example:admin@example.com root).  If more than one email address is
+given, then this string will contain space characters and is NOT
+quoted, so to use it in a bash script you may want to enclose it in
+double quotes.
+.IP \fBSMARTD_MESSAGE\fP 4
+is set to the one sentence summary warning email message string from
+\fBsmartd\fP. 
+This message string contains space characters and is NOT quoted. So to
+use $SMARTD_MESSAGE in a bash script you should probably enclose it in
+double quotes.
+.IP \fBSMARTD_FULLMESSAGE\fP 4
+is set to the contents of the entire email warning message string from
+\fBsmartd\fP. 
+This message string contains space and return characters and is NOT quoted. So to
+use $SMARTD_FULLMESSAGE in a bash script you should probably enclose it in
+double quotes.
+.IP \fBSMARTD_TFIRST\fP 4
+is a text string giving the time and date at which the first problem
+of this type was reported. This text string contains space characters
+and no newlines, and is NOT quoted. For example:
+.nf
+.fi
+Sun Feb  9 14:58:19 2003 CST
+.IP \fBSMARTD_TFIRSTEPOCH\fP 4
+is an integer, which is the unix epoch (number of seconds since Jan 1,
+1970) for \fBSMARTD_TFIRST\fP.
+.RE
+.\"  The following two lines are a workaround for a man2html bug.  Please leave them.
+.\" They define a non-existent option; useful because man2html can't correctly reset the margins.
+.TP
+.B \&
+The shell which is used to run PATH is system-dependent. For vanilla
+Linux/glibc it\'s bash. For other systems, the man page for
+\fBpopen\fP(3) should say what shell is used.
+
+If the \'\-m ADD\' Directive is given with a normal address argument,
+then the executable pointed to by PATH will be run in a shell with
+STDIN receiving the body of the email message, and with the same
+command-line arguments:
+.nf
+-s "$SMARTD_SUBJECT" $SMARTD_ADDRESS
+.fi
+that would normally be provided to \'mail\'.  Examples include:
+.nf
+.B -m user@home -M exec /bin/mail
+.B -m admin@work -M exec /usr/local/bin/mailto
+.B -m root -M exec /Example_1/bash/script/below
+.fi
+
+Note that on Windows, the syntax of the \'\fBBlat\fP\' mailer is
+used:
+.nf
+- -q -subject "$SMARTD_SUBJECT" -to "$SMARTD_ADDRESS"
+.fi
+
+If the \'\-m ADD\' Directive is given with the special address argument
+.B <nomailer>
+then the executable pointed to by PATH is run in a shell with
+.B no
+STDIN and
+.B no
+command-line arguments, for example:
+.nf
+.B -m <nomailer> -M exec /Example_2/bash/script/below
+.fi
+If the executable produces any STDERR/STDOUT output, then \fBsmartd\fP
+assumes that something is going wrong, and a snippet of that output
+will be copied to SYSLOG.  The remainder of the output is then
+discarded.
+
+Some EXAMPLES of scripts that can be used with the \'\-M exec\'
+Directive are given below. Some sample scripts are also included in
+/usr/local/share/doc/smartmontools-5.1/examplescripts/.
+
+.TP
+.B \-f
+Check for \'failure\' of any Usage Attributes.  If these Attributes are
+less than or equal to the threshold, it does NOT indicate imminent
+disk failure.  It "indicates an advisory condition where the usage or
+age of the device has exceeded its intended design life period."
+[Please see the \fBsmartctl \-A\fP command-line option.]
+.TP
+.B \-p
+Report anytime that a Prefail Attribute has changed
+its value since the last check, 30 minutes ago. [Please see the
+.B smartctl \-A
+command-line option.]
+.TP
+.B \-u
+Report anytime that a Usage Attribute has changed its value
+since the last check, 30 minutes ago. [Please see the
+.B smartctl \-A
+command-line option.]
+.TP
+.B \-t
+Equivalent to turning on the two previous flags \'\-p\' and \'\-u\'.
+Tracks changes in \fIall\fP device Attributes (both Prefailure and
+Usage). [Please see the \fBsmartctl\fP \-A command-line option.]
+.TP
+.B \-i ID
+Ignore device Attribute number \fBID\fP when checking for failure of
+Usage Attributes.  \fBID\fP must be a decimal integer in the range
+from 1 to 255.  This Directive modifies the behavior of the \'\-f\'
+Directive and has no effect without it.
+
+This is useful, for example, if you have a very old disk and don\'t
+want to keep getting messages about the hours-on-lifetime Attribute
+(usually Attribute 9) failing.  This Directive may appear multiple
+times for a single device, if you want to ignore multiple Attributes.
+.TP
+.B \-I ID
+Ignore device Attribute \fBID\fP when tracking changes in the
+Attribute values.  \fBID\fP must be a decimal integer in the range
+from 1 to 255.  This Directive modifies the behavior of the \'\-p\',
+\'\-u\', and \'\-t\' tracking Directives and has no effect without one
+of them.
+
+This is useful, for example, if one of the device Attributes is the disk
+temperature (usually Attribute 194 or 231). It\'s annoying to get reports
+each time the temperature changes.  This Directive may appear multiple
+times for a single device, if you want to ignore multiple Attributes.
+.TP
+.B \-r ID
+When tracking, report the \fIRaw\fP value of Attribute \fBID\fP along
+with its (normally reported) \fINormalized\fP value.  \fBID\fP must be
+a decimal integer in the range from 1 to 255.  This Directive modifies
+the behavior of the \'\-p\', \'\-u\', and \'\-t\' tracking Directives
+and has no effect without one of them.  This Directive may be given
+multiple times.
+
+A common use of this Directive is to track the device Temperature
+(often ID=194 or 231).
+
+.TP
+.B \-R ID
+When tracking, report whenever the \fIRaw\fP value of Attribute
+\fBID\fP changes.  (Normally \fBsmartd\fP only tracks/reports changes
+of the \fINormalized\fP Attribute values.)  \fBID\fP must be a decimal
+integer in the range from 1 to 255.  This Directive modifies the
+behavior of the \'\-p\', \'\-u\', and \'\-t\' tracking Directives and
+has no effect without one of them.  This Directive may be given
+multiple times.
+
+If this Directive is given, it automatically implies the \'\-r\'
+Directive for the same Attribute, so that the Raw value of the
+Attribute is reported.
+
+A common use of this Directive is to track the device Temperature
+(often ID=194 or 231).  It is also useful for understanding how
+different types of system behavior affects the values of certain
+Attributes.
+
+.TP
+.B \-C ID
+[ATA only] Report if the current number of pending sectors is
+non-zero.  Here \fBID\fP is the id number of the Attribute whose raw
+value is the Current Pending Sector count.  The allowed range of
+\fBID\fP is 0 to 255 inclusive.  To turn off this reporting, use
+ID\ =\ 0.  If the \fB\-C ID\fP option is not given, then it defaults to
+\fB\-C 197\fP (since Attribute 197 is generally used to monitor
+pending sectors).
+
+A pending sector is a disk sector (containing 512 bytes of your data)
+which the device would like to mark as ``bad" and reallocate.
+Typically this is because your computer tried to read that sector, and
+the read failed because the data on it has been corrupted and has
+inconsistent Error Checking and Correction (ECC) codes.  This is
+important to know, because it means that there is some unreadable data
+on the disk.  The problem of figuring out what file this data belongs
+to is operating system and file system specific.  You can typically
+force the sector to reallocate by writing to it (translation: make the
+device substitute a spare good sector for the bad one) but at the
+price of losing the 512 bytes of data stored there.
+
+.TP
+.B \-U ID
+[ATA only] Report if the number of offline uncorrectable sectors is
+non-zero.  Here \fBID\fP is the id number of the Attribute whose raw
+value is the Offline Uncorrectable Sector count.  The allowed range of
+\fBID\fP is 0 to 255 inclusive.  To turn off this reporting, use
+ID\ =\ 0.  If the \fB\-U ID\fP option is not given, then it defaults to
+\fB\-U 198\fP (since Attribute 198 is generally used to monitor
+offline uncorrectable sectors).
+
+
+An offline uncorrectable sector is a disk sector which was not
+readable during an off\-line scan or a self\-test.  This is important
+to know, because if you have data stored in this disk sector, and you
+need to read it, the read will fail.  Please see the previous \'\-C\'
+option for more details.
+
+.TP
+.B \-W DIFF[,INFO[,CRIT]]
+Report if the current temperature had changed by at least \fBDIFF\fP
+degrees since last report. Report or Warn if the temperature is greater
+or equal than one of \fBINFO\fP or \fBCRIT\fP degrees Celsius. If the
+limit \fBCRIT\fP is reached, a message with loglevel
+\fB\'LOG_CRITICAL\'\fP will be logged to syslog and a warning email
+will be send if '-m' is specified. If only the limit \fBINFO\fP is
+reached, a message with loglevel \fB\'LOG_INFO\'\fP will be logged.
+
+To disable any of the 3 reports, set the corresponding limit to 0.
+Trailing zero arguments may be omitted. By default, all temperature
+reports are disabled (\'-W 0\').
+
+To track temperature changes of at least 2 degrees, use:
+.nf
+\fB \-W 2
+.fi
+To log informal messages on temperatures of at least 40 degrees, use:
+.nf
+\fB \-W 0,40
+.fi
+For warning messages/mails on temperatures of at least 45 degrees, use:
+.nf
+\fB \-W 0,0,45
+.fi
+To combine all of the above reports, use:
+.nf
+\fB \-W 2,40,45
+.fi
+
+For ATA devices, smartd interprets Attribute 194 as Temperature Celsius
+by default. This can be changed to Attribute 9 or 220 by the drive
+database or by the \'-v\' directive, see below.
+
+.TP
+.B \-F TYPE
+[ATA only] Modifies the behavior of \fBsmartd\fP to compensate for
+some known and understood device firmware bug.  The arguments to this
+Directive are exclusive, so that only the final Directive given is
+used.  The valid values are:
+
+.I none
+\- Assume that the device firmware obeys the ATA specifications.  This is
+the default, unless the device has presets for \'\-F\' in the device
+database.
+
+.I samsung
+\- In some Samsung disks (example: model SV4012H Firmware Version:
+RM100-08) some of the two- and four-byte quantities in the SMART data
+structures are byte-swapped (relative to the ATA specification).
+Enabling this option tells \fBsmartd\fP to evaluate these quantities
+in byte-reversed order.  Some signs that your disk needs this option
+are (1) no self-test log printed, even though you have run self-tests;
+(2) very large numbers of ATA errors reported in the ATA error log;
+(3) strange and impossible values for the ATA error log timestamps.
+
+.I samsung2
+\- In more recent Samsung disks (firmware revisions ending in "\-23") the
+number of ATA errors reported is byte swapped.  Enabling this option
+tells \fBsmartd\fP to evaluate this quantity in byte-reversed order.
+
+Note that an explicit \'\-F\' Directive will over-ride any preset
+values for \'\-F\' (see the \'\-P\' option below).
+
+
+[Please see the \fBsmartctl \-F\fP command-line option.]
+
+.TP
+.B \-v N,OPTION
+Modifies the labeling for Attribute N, for disks which use
+non-standard Attribute definitions.  This is useful in connection with
+the Attribute tracking/reporting Directives.
+
+This Directive may appear multiple times. Valid arguments to this
+Directive are:
+
+.I 9,minutes
+\- Raw Attribute number 9 is power-on time in minutes.  Its raw value
+will be displayed in the form \'Xh+Ym\'.  Here X is hours, and Y is
+minutes in the range 0-59 inclusive.  Y is always printed with two
+digits, for example \'06\' or \'31\' or \'00\'.
+
+.I 9,seconds
+\- Raw Attribute number 9 is power-on time in seconds.  Its raw value
+will be displayed in the form \'Xh+Ym+Zs\'.  Here X is hours, Y is
+minutes in the range 0-59 inclusive, and Z is seconds in the range
+0-59 inclusive.  Y and Z are always printed with two digits, for
+example \'06\' or \'31\' or \'00\'.
+
+.I 9,halfminutes
+\- Raw Attribute number 9 is power-on time, measured in units of 30
+seconds.  This format is used by some Samsung disks.  Its raw value
+will be displayed in the form \'Xh+Ym\'.  Here X is hours, and Y is
+minutes in the range 0-59 inclusive.  Y is always printed with two
+digits, for example \'06\' or \'31\' or \'00\'.
+
+.I 9,temp
+\- Raw Attribute number 9 is the disk temperature in Celsius.
+
+.I 192,emergencyretractcyclect
+\- Raw Attribute number 192 is the Emergency Retract Cycle Count.
+
+.I 193,loadunload
+\- Raw Attribute number 193 contains two values. The first is the
+number of load cycles.  The second is the number of unload cycles.
+The difference between these two values is the number of times that
+the drive was unexpectedly powered off (also called an emergency
+unload). As a rule of thumb, the mechanical stress created by one
+emergency unload is equivalent to that created by one hundred normal
+unloads.
+
+.I 194,10xCelsius
+\- Raw Attribute number 194 is ten times the disk temperature in
+Celsius.  This is used by some Samsung disks (example: model SV1204H
+with RK100-13 firmware).
+
+.I 194,unknown
+\- Raw Attribute number 194 is NOT the disk temperature, and its
+interpretation is unknown. This is primarily useful for the -P
+(presets) Directive.
+
+.I 198,offlinescanuncsectorct
+\- Raw Attribute number 198 is the Offline Scan UNC Sector Count.
+
+.I 200,writeerrorcount
+\- Raw Attribute number 200 is the Write Error Count.
+
+.I 201,detectedtacount
+\- Raw Attribute number 201 is the Detected TA Count.
+
+.I 220,temp
+\- Raw Attribute number 220 is the disk temperature in Celsius.
+
+Note: a table of hard drive models, listing which Attribute
+corresponds to temperature, can be found at:
+\fBhttp://www.guzu.net/linux/hddtemp.db\fP
+
+.I N,raw8
+\- Print the Raw value of Attribute N as six 8-bit unsigned base-10
+integers.  This may be useful for decoding the meaning of the Raw
+value.  The form \'N,raw8\' prints Raw values for ALL Attributes in this
+form.  The form (for example) \'123,raw8\' only prints the Raw value for
+Attribute 123 in this form.
+
+.I N,raw16
+\- Print the Raw value of Attribute N as three 16-bit unsigned base-10
+integers.  This may be useful for decoding the meaning of the Raw
+value.  The form \'N,raw16\' prints Raw values for ALL Attributes in this
+form.  The form (for example) \'123,raw16\' only prints the Raw value for
+Attribute 123 in this form.
+
+.I N,raw48
+\- Print the Raw value of Attribute N as a 48-bit unsigned base-10
+integer.  This may be useful for decoding the meaning of the Raw
+value.  The form \'N,raw48\' prints Raw values for ALL Attributes in
+this form.  The form (for example) \'123,raw48\' only prints the Raw
+value for Attribute 123 in this form.
+
+.TP
+.B \-P TYPE
+Specifies whether
+\fBsmartd\fP
+should use any preset options that are available for this drive.  The
+valid arguments to this Directive are:
+
+.I use
+\- use any presets that are available for this drive.  This is the default.
+
+.I ignore
+\- do not use any presets for this drive.
+
+.I show
+\- show the presets listed for this drive in the database.
+
+.I showall
+\- show the presets that are available for all drives and then exit.
+
+[Please see the
+.B smartctl \-P
+command-line option.]
+
+.TP
+.B \-a
+Equivalent to turning on all of the following Directives: 
+.B \'\-H\' 
+to check the SMART health status,
+.B \'\-f\' 
+to report failures of Usage (rather than Prefail) Attributes,
+.B \'\-t\' 
+to track changes in both Prefailure and Usage Attributes,
+.B \'\-l\ selftest\' 
+to report increases in the number of Self-Test Log errors,
+.B \'\-l\ error\' 
+to report increases in the number of ATA errors,
+.B \'\-C 197\'
+to report nonzero values of the current pending sector count, and
+.B \'\-U 198\'
+to report nonzero values of the offline pending sector count.
+
+Note that \-a is the default for ATA devices.  If none of these other
+Directives is given, then \-a is assumed.
+
+.TP
+.B #
+Comment: ignore the remainder of the line.
+.TP
+.B \e
+Continuation character: if this is the last non-white or non-comment
+character on a line, then the following line is a continuation of the current
+one.
+.PP
+If you are not sure which Directives to use, I suggest experimenting
+for a few minutes with
+.B smartctl
+to see what SMART functionality your disk(s) support(s).  If you do
+not like voluminous syslog messages, a good choice of
+\fBsmartd\fP
+configuration file Directives might be:
+.nf
+.B \-H \-l\ selftest \-l\ error \-f.
+.fi
+If you want more frequent information, use:
+.B -a.
+
+.TP
+.B ADDITIONAL DETAILS ABOUT DEVICESCAN
+If the first non-comment entry in the configuration file is the text
+string \fBDEVICESCAN\fP in capital letters, then \fBsmartd\fP will
+ignore any remaining lines in the configuration file, and will scan
+for devices.
+
+If \fBDEVICESCAN\fP is not followed by any Directives, then smartd
+will scan for both ATA and SCSI devices, and will monitor all possible
+SMART properties of any devices that are found.
+
+\fBDEVICESCAN\fP may optionally be followed by any valid Directives,
+which will be applied to all devices that are found in the scan.  For
+example
+.nf
+.B DEVICESCAN -m root@example.com
+.fi
+will scan for all devices, and then monitor them.  It will send one
+email warning per device for any problems that are found.
+.nf
+.B  DEVICESCAN -d ata -m root@example.com
+.fi
+will do the same, but restricts the scan to ATA devices only.  
+.nf
+.B  DEVICESCAN -H -d ata -m root@example.com
+.fi
+will do the same, but only monitors the SMART health status of the
+devices, (rather than the default \-a, which monitors all SMART
+properties).
+
+.TP
+.B EXAMPLES OF SHELL SCRIPTS FOR \'\-M exec\'
+These are two examples of shell scripts that can be used with the \'\-M
+exec PATH\' Directive described previously.  The paths to these scripts
+and similar executables is the PATH argument to the \'\-M exec PATH\'
+Directive.
+
+Example 1: This script is for use with \'\-m ADDRESS -M exec PATH\'.  It appends
+the output of
+.B smartctl -a
+to the output of the smartd email warning message and sends it to ADDRESS.
+
+.nf
+\fB
+#! /bin/bash
+
+# Save the email message (STDIN) to a file:
+cat > /root/msg
+
+# Append the output of smartctl -a to the message:
+/usr/local/sbin/smartctl -a -d $SMART_DEVICETYPE $SMARTD_DEVICE >> /root/msg
+# Now email the message to the user at address ADD:
+/bin/mail -s "$SMARTD_SUBJECT" $SMARTD_ADDRESS < /root/msg
+\fP
+.fi
+
+Example 2: This script is for use with \'\-m <nomailer> \-M exec
+PATH\'. It warns all users about a disk problem, waits 30 seconds, and
+then powers down the machine.
+
+.nf
+\fB
+#! /bin/bash
+
+# Warn all users of a problem
+wall \'Problem detected with disk: \' "$SMARTD_DEVICESTRING"
+wall \'Warning message from smartd is: \' "$SMARTD_MESSAGE"
+wall \'Shutting down machine in 30 seconds... \'
+# Wait half a minute
+sleep 30
+# Power down the machine
+/sbin/shutdown -hf now
+\fP
+.fi
+
+Some example scripts are distributed with the smartmontools package,
+in /usr/local/share/doc/smartmontools-5.1/examplescripts/.
+
+Please note that these scripts typically run as root, so any files
+that they read/write should not be writable by ordinary users or
+reside in directories like /tmp that are writable by ordinary users
+and may expose your system to symlink attacks.
+
+As previously described, if the scripts write to STDOUT or STDERR,
+this is interpreted as indicating that there was an internal error
+within the script, and a snippet of STDOUT/STDERR is logged to SYSLOG.
+The remainder is flushed.
+
+.\" ENDINCLUDE
+.\" DO NOT MODIFY THIS OR PREVIOUS/NEXT LINES. THIS DEFINES THE 
+.\" END OF THE INCLUDE SECTION FOR smartd.conf.5
+
+.SH NOTES
+\fBsmartd\fP
+will make log entries at loglevel 
+.B LOG_INFO
+if the Normalized SMART Attribute values have changed, as reported using the
+.B \'\-t\', \'\-p\',
+or
+.B \'\-u\'
+Directives. For example:
+.nf
+.B \'Device: /dev/hda, SMART Attribute: 194 Temperature_Celsius changed from 94 to 93\'
+.fi
+Note that in this message, the value given is the \'Normalized\' not the \'Raw\' 
+Attribute value (the disk temperature in this case is about 22
+Celsius).  The 
+.B \'-R\'
+and 
+.B \'-r\'
+Directives modify this behavior, so that the information is printed
+with the Raw values as well, for example:
+.nf
+.B \'Device: /dev/hda, SMART Attribute: 194 Temperature_Celsius changed from 94 [Raw 22] to 93 [Raw 23]\'
+.fi
+Here the Raw values are the actual disk temperatures in Celsius.  The
+way in which the Raw values are printed, and the names under which the
+Attributes are reported, is governed by the various
+.B \'-v Num,Description\'
+Directives described previously.
+
+Please see the
+.B smartctl
+manual page for further explanation of the differences between
+Normalized and Raw Attribute values.
+
+\fBsmartd\fP
+will make log entries at loglevel
+.B LOG_CRIT
+if a SMART Attribute has failed, for example:
+.nf
+.B \'Device: /dev/hdc, Failed SMART Attribute: 5 Reallocated_Sector_Ct\'
+.fi
+ This loglevel is used for reporting enabled by the
+.B \'\-H\', \-f\', \'\-l\ selftest\',
+and
+.B \'\-l\ error\'
+Directives. Entries reporting failure of SMART Prefailure Attributes
+should not be ignored: they mean that the disk is failing.  Use the
+.B smartctl
+utility to investigate. 
+
+Under Solaris with the default \fB/etc/syslog.conf\fP configuration,
+messages below loglevel \fBLOG_NOTICE\fP will \fBnot\fP be recorded.
+Hence all \fBsmartd\fP messages with loglevel \fBLOG_INFO\fP will be
+lost.  If you want to use the existing daemon facility to log all
+messages from \fBsmartd\fP, you should change \fB/etc/syslog.conf\fP
+from:
+.nf
+       ...;daemon.notice;...        /var/adm/messages
+.fi
+to read:
+.nf
+       ...;daemon.info;...          /var/adm/messages
+.fi
+Alternatively, you can use a local facility to log messages: please
+see the \fBsmartd\fP '-l' command-line option described above.
+
+On Cygwin and Windows, the log messages are written to the event log
+or to a file. See documentation of the '-l FACILITY' option above for
+details.
+
+On Windows, the following built-in commands can be used to control
+\fBsmartd\fP, if running as a daemon:
+
+\'\fBsmartd status\fP\' \- check status
+
+\'\fBsmartd stop\fP\' \- stop smartd
+
+\'\fBsmartd reload\fP\' \- reread config file
+
+\'\fBsmartd restart\fP\' \- restart smartd
+
+\'\fBsmartd sigusr1\fP\' \- check disks now
+
+\'\fBsmartd sigusr2\fP\' \- toggle debug mode
+
+On WinNT4/2000/XP, \fBsmartd\fP can also be run as a Windows service:
+
+
+The Cygwin Version of \fBsmartd\fP can be run as a service via the
+cygrunsrv tool. The start-up script provides Cygwin-specific commands
+to install and remove the service:
+.nf
+.B /usr/local/etc/rc.d/init.d/smartd install [options]
+.B /usr/local/etc/rc.d/init.d/smartd remove
+.fi
+The service can be started and stopped by the start-up script as usual
+(see \fBEXAMPLES\fP above).
+
+
+The Windows Version of \fBsmartd\fP has buildin support for services:
+
+\'\fBsmartd install [options]\fP\' installs a service
+named "smartd" (display name "SmartD Service") using the command line
+\'/installpath/smartd.exe --service [options]\'.
+
+\'\fBsmartd remove\fP\' can later be used to remove the service entry
+from registry.
+
+Upon startup, the smartd service changes the working directory
+to its own installation path. If smartd.conf and blat.exe are stored
+in this directory, no \'-c\' option and \'-M exec\' directive is needed.
+
+The debug mode (\'-d\', \'-q onecheck\') does not work if smartd is
+running as service.
+
+The service can be controlled as usual with Windows commands \'net\'
+or \'sc\' (\'\fBnet start smartd\fP\', \'\fBnet stop smartd\fP\').
+
+Pausing the service (\'\fBnet pause smartd\fP\') sets the interval between
+disk checks (\'-i N\') to infinite.
+
+Continuing the paused service (\'\fBnet continue smartd\fP\') resets the
+interval and rereads the configuration file immediately (like \fBSIGHUP\fP):
+
+Continuing a still running service (\'\fBnet continue smartd\fP\' without
+preceding \'\fBnet pause smartd\fP\') does not reread configuration but
+checks disks immediately (like \fBSIGUSR1\fP).
+
+.SH LOG TIMESTAMP TIMEZONE
+
+When \fBsmartd\fP makes log entries, these are time-stamped.  The time
+stamps are in the computer's local time zone, which is generally set
+using either the environment variable \'\fBTZ\fP\' or using a
+time-zone file such as \fB/etc/localtime\fP.  You may wish to change
+the timezone while \fBsmartd\fP is running (for example, if you carry
+a laptop to a new time-zone and don't reboot it).  Due to a bug in the
+\fBtzset(3)\fP function of many unix standard C libraries, the
+time-zone stamps of \fBsmartd\fP might not change.  For some systems,
+\fBsmartd\fP will work around this problem \fIif\fP the time-zone is
+set using \fB/etc/localtime\fP. The work-around \fIfails\fP if the
+time-zone is set using the \'\fBTZ\fP\' variable (or a file that it
+points to).
+
+
+.SH RETURN VALUES
+The return value (exit status) of 
+\fBsmartd\fP
+can have the following values:
+.TP
+.B 0:
+Daemon startup successful, or \fBsmartd\fP was killed by a SIGTERM (or in debug mode, a SIGQUIT).
+.TP
+.B 1:
+Commandline did not parse.
+.TP
+.B 2:
+There was a syntax error in the config file.
+.TP
+.B 3:
+Forking the daemon failed.
+.TP
+.B 4:
+Couldn\'t create PID file.
+.TP
+.B 5:
+Config file does not exist (only returned in conjunction with the \'-c\' option).
+.TP
+.B 6:
+Config file exists, but cannot be read.
+.TP
+.B 8:
+\fBsmartd\fP
+ran out of memory during startup.
+.TP
+.B 9:
+A compile time constant of\fB smartd\fP was too small.  This can be caused by an
+excessive number of disks, or by lines in \fB /usr/local/etc/smartd.conf\fP that are too long.
+Please report this problem to \fB smartmontools-support@lists.sourceforge.net\fP.
+.TP
+.B 10
+An inconsistency was found in \fBsmartd\fP\'s internal data
+structures. This should never happen.  It must be due to either a
+coding or compiler bug.  \fIPlease\fP report such failures to
+smartmontools-support@lists.sourceforge.net.
+.TP
+.B 16:
+A device explicitly listed in
+.B /usr/local/etc/smartd.conf
+can\'t be monitored.
+.TP
+.B 17:
+\fBsmartd\fP
+didn\'t find any devices to monitor.
+.TP
+.B 254:
+When in daemon mode,
+\fBsmartd\fP
+received a SIGINT or SIGQUIT.  (Note that in debug mode, SIGINT has
+the same effect as SIGHUP, and makes \fBsmartd\fP reload its
+configuration file. SIGQUIT has the same effect as SIGTERM and causes
+\fBsmartd\fP to exit with zero exit status.
+.TP
+.B 132 and above
+\fBsmartd\fP
+was killed by a signal that is not explicitly listed above.  The exit
+status is then 128 plus the signal number.  For example if
+\fBsmartd\fP
+is killed by SIGKILL (signal 9) then the exit status is 137.
+
+.PP
+.SH AUTHOR
+\fBBruce Allen\fP smartmontools-support@lists.sourceforge.net
+.fi
+University of Wisconsin \- Milwaukee Physics Department
+
+.PP
+.SH CONTRIBUTORS
+The following have made large contributions to smartmontools:
+.nf
+\fBCasper Dik\fP (Solaris SCSI interface)
+\fBChristian Franke\fP (Windows interface and Cygwin package)
+\fBDouglas Gilbert\fP (SCSI subsystem)
+\fBGuido Guenther\fP (Autoconf/Automake packaging)
+\fBGeoffrey Keating\fP (Darwin ATA interface)
+\fBEduard Martinescu\fP (FreeBSD interface)
+\fBFr\*'ed\*'eric L. W. Meunier\fP (Web site and Mailing list)
+\fBKeiji Sawada\fP (Solaris ATA interface)
+\fBSergey Svishchev\fP (NetBSD interface)
+\fBDavid Snyder and Sergey Svishchev\fP (OpenBSD interface)
+\fBPhil Williams\fP (User interface and drive database)
+.fi
+Many other individuals have made smaller contributions and corrections.
+
+.PP
+.SH CREDITS
+.fi
+This code was derived from the smartsuite package, written by Michael
+Cornwell, and from the previous ucsc smartsuite package. It extends
+these to cover ATA-5 disks. This code was originally developed as a
+Senior Thesis by Michael Cornwell at the Concurrent Systems Laboratory
+(now part of the Storage Systems Research Center), Jack Baskin School
+of Engineering, University of California, Santa
+Cruz. \fBhttp://ssrc.soe.ucsc.edu/\fP .
+.SH
+HOME PAGE FOR SMARTMONTOOLS: 
+.fi
+Please see the following web site for updates, further documentation, bug
+reports and patches: \fBhttp://smartmontools.sourceforge.net/\fP
+
+.SH SEE ALSO:
+\fBsmartd.conf\fP(5), \fBsmartctl\fP(8), \fBsyslogd\fP(8),
+\fBsyslog.conf\fP(5), \fBbadblocks\fP(8), \fBide\-smart\fP(8), \fBregex\fP(7).
+
+.SH
+REFERENCES FOR SMART
+.fi
+An introductory article about smartmontools is \fIMonitoring Hard
+Disks with SMART\fP, by Bruce Allen, Linux Journal, January 2004,
+pages 74-77. This is \fBhttp://www.linuxjournal.com/article.php?sid=6983\fP
+online.
+
+If you would like to understand better how SMART works, and what it
+does, a good place to start is with Sections 4.8 and 6.54 of the first
+volume of the \'AT Attachment with Packet Interface-7\' (ATA/ATAPI-7)
+specification.  This documents the SMART functionality which the
+\fBsmartmontools\fP utilities provide access to.  You can find
+Revision 4b of this document at
+\fBhttp://www.t13.org/docs2004/d1532v1r4b-ATA-ATAPI-7.pdf\fP .
+Earlier and later versions of this Specification are available from
+the T13 web site \fBhttp://www.t13.org/\fP .
+
+.fi
+The functioning of SMART was originally defined by the SFF-8035i
+revision 2 and the SFF-8055i revision 1.4 specifications.  These are
+publications of the Small Form Factors (SFF) Committee.  Links to
+these documents may be found in the References section of the
+smartmontools home page at \fBhttp://smartmontools.sourceforge.net/#references\fP .
+
+.SH
+CVS ID OF THIS PAGE:
+$Id: smartd.8.in,v 1.106 2006/09/27 21:42:03 chrfranke Exp $
index cf129532739e54228ffc827a1b77718a792b22b2..db65ad2896a87073996c28b6701a2fd04018bfe3 100644 (file)
@@ -1,7 +1,7 @@
 .ig
-Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 
-$Id: smartd.conf.5.in,v 1.82 2006/12/20 07:30:43 sxzzsf Exp $
+$Id: smartd.conf.5.in,v 1.86 2007/10/20 13:02:50 chrfranke 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
@@ -298,10 +298,10 @@ controllers (using the Marvell rather than libata driver).
 
 .I 3ware,N
 \- the device consists of one or more ATA disks connected to a 3ware
-RAID controller. The non-negative integer N (in the range from 0 to 15
+RAID controller. The non-negative integer N (in the range from 0 to 31
 inclusive) denotes which disk on the controller is monitored.  In log
 files and email messages this disk will be identified as 3ware_disk_XX
-with XX in the range from 00 to 15 inclusive.
+with XX in the range from 00 to 31 inclusive.
 
 This Directive may at first appear confusing, because the 3ware
 controller is a SCSI device (such as /dev/sda) and should be listed as
@@ -571,6 +571,10 @@ interrupted to begin another test.
 \fBsmartd\fP will not attempt to run \fBany\fP type of test if another
 test was already started or run in the same hour.
 
+To avoid performance problems during system boot, \fBsmartd\fP will
+not attempt to run any scheduled tests following the very first
+device polling (unless \'\-q onecheck\' is specified).
+
 Each time a test is run, \fBsmartd\fP will log an entry to SYSLOG.
 You can use these or the '-q showtests' command-line option to verify
 that you constructed \fBREGEXP\fP correctly.  The matching order
@@ -729,7 +733,7 @@ is set to the argument of \-M exec, if present or else to \'mail\'
 is set to the device path (examples: /dev/hda, /dev/sdb).
 .IP \fBSMARTD_DEVICETYPE\fP 4
 is set to the device type (possible values: ata, scsi, 3ware,N, hpt,L/M/N).
-Here N=0,...,15 denotes the ATA disk behind a 3ware RAID controller and
+Here N=0,...,23 denotes the ATA disk behind a 3ware RAID controller and
 L/M/N denotes the SATA disk behind a HighPoint RocketRAID controller.
 .IP \fBSMARTD_DEVICESTRING\fP 4
 is set to the device description.  For SMARTD_DEVICETYPE of ata or
@@ -1038,6 +1042,12 @@ are (1) no self-test log printed, even though you have run self-tests;
 number of ATA errors reported is byte swapped.  Enabling this option
 tells \fBsmartd\fP to evaluate this quantity in byte-reversed order.
 
+.I samsung3
+\- Some Samsung disks (at least SP2514N with Firmware VF100\-37) report
+a self\-test still in progress with 0% remaining when the test was already
+completed. If this directive is specified, \fBsmartd\fP will not skip the
+next scheduled self\-test (see Directive \'\-s\' above) in this case.
+
 Note that an explicit \'\-F\' Directive will over-ride any preset
 values for \'\-F\' (see the \'\-P\' option below).
 
@@ -1347,4 +1357,4 @@ SEE ALSO:
 
 .SH
 CVS ID OF THIS PAGE:
-$Id: smartd.conf.5.in,v 1.82 2006/12/20 07:30:43 sxzzsf Exp $
+$Id: smartd.conf.5.in,v 1.86 2007/10/20 13:02:50 chrfranke Exp $
index 1f1e179d7ed95b1d61f8aebd6f19dade0776894f..d7c8dcdd0c44303699a360764fef6c5b3537a3e0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -119,14 +119,14 @@ extern "C" int getdomainname(char *, int); // no declaration in header files!
 extern const char *atacmdnames_c_cvsid, *atacmds_c_cvsid, *ataprint_c_cvsid, *escalade_c_cvsid, 
                   *knowndrives_c_cvsid, *os_XXXX_c_cvsid, *scsicmds_c_cvsid, *utility_c_cvsid;
 
-static const char *filenameandversion="$Id: smartd.cpp,v 1.384 2006/11/12 04:49:09 dpgilbert Exp $";
+static const char *filenameandversion="$Id: smartd.cpp,v 1.394 2007/11/01 20:53:30 chrfranke Exp $";
 #ifdef NEED_SOLARIS_ATA_CODE
 extern const char *os_solaris_ata_s_cvsid;
 #endif
 #ifdef _WIN32
 extern const char *daemon_win32_c_cvsid, *hostname_win32_c_cvsid, *syslog_win32_c_cvsid;
 #endif
-const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.384 2006/11/12 04:49:09 dpgilbert Exp $" 
+const char *smartd_c_cvsid="$Id: smartd.cpp,v 1.394 2007/11/01 20:53:30 chrfranke Exp $" 
 ATACMDS_H_CVSID ATAPRINT_H_CVSID CONFIG_H_CVSID
 #ifdef DAEMON_WIN32_H_CVSID
 DAEMON_WIN32_H_CVSID
@@ -174,9 +174,9 @@ static int quit=0;
 // command-line; this is the default syslog(3) log facility to use.
 static int facility=LOG_DAEMON;
 
-#ifdef __CYGWIN__
-// command-line: running as service, so don't fork()
-static int is_service=0;
+#ifndef _WIN32
+// command-line: fork into background?
+static bool do_fork=true;
 #endif
 
 // used for control of printing, passing arguments to atacmds.c
@@ -310,7 +310,7 @@ void PrintOneCVS(const char *a_cvs_id){
 
 // prints CVS identity information for the executable
 void PrintCVS(void){
-  char *configargs=strlen(SMARTMONTOOLS_CONFIGURE_ARGS)?SMARTMONTOOLS_CONFIGURE_ARGS:"[no arguments given]";
+  const char *configargs=strlen(SMARTMONTOOLS_CONFIGURE_ARGS)?SMARTMONTOOLS_CONFIGURE_ARGS:"[no arguments given]";
 
   PrintOut(LOG_INFO,(char *)copyleftstring);
   PrintOut(LOG_INFO,"CVS version IDs of files used to build this code are:\n");
@@ -1001,30 +1001,32 @@ void DaemonInit(){
   // flush all buffered streams.  Else we might get two copies of open
   // streams since both parent and child get copies of the buffers.
   fflush(NULL);
+
+  if (do_fork) {
+    if ((pid=fork()) < 0) {
+      // unable to fork!
+      PrintOut(LOG_CRIT,"smartd unable to fork daemon process!\n");
+      EXIT(EXIT_STARTUP);
+    }
+    else if (pid)
+      // we are the parent process -- exit cleanly
+      EXIT(0);
   
-  if ((pid=fork()) < 0) {
-    // unable to fork!
-    PrintOut(LOG_CRIT,"smartd unable to fork daemon process!\n");
-    EXIT(EXIT_STARTUP);
-  }
-  else if (pid)
-    // we are the parent process -- exit cleanly
-    EXIT(0);
-  
-  // from here on, we are the child process.
-  setsid();
+    // from here on, we are the child process.
+    setsid();
 
-  // Fork one more time to avoid any possibility of having terminals
-  if ((pid=fork()) < 0) {
-    // unable to fork!
-    PrintOut(LOG_CRIT,"smartd unable to fork daemon process!\n");
-    EXIT(EXIT_STARTUP);
-  }
-  else if (pid)
-    // we are the parent process -- exit cleanly
-    EXIT(0);
+    // Fork one more time to avoid any possibility of having terminals
+    if ((pid=fork()) < 0) {
+      // unable to fork!
+      PrintOut(LOG_CRIT,"smartd unable to fork daemon process!\n");
+      EXIT(EXIT_STARTUP);
+    }
+    else if (pid)
+      // we are the parent process -- exit cleanly
+      EXIT(0);
 
-  // Now we are the child's child...
+    // Now we are the child's child...
+  }
 
   // close any open file descriptors
   for (i=getdtablesize();i>=0;--i)
@@ -1043,8 +1045,9 @@ void DaemonInit(){
   dup(i);
   umask(0);
   chdir("/");
-  
-  PrintOut(LOG_INFO, "smartd has fork()ed into background mode. New PID=%d.\n", (int)getpid());
+
+  if (do_fork)
+    PrintOut(LOG_INFO, "smartd has fork()ed into background mode. New PID=%d.\n", (int)getpid());
 
 #else // _WIN32
 
@@ -1100,7 +1103,7 @@ void PrintHead(){
 #else
   const char * ver = SMARTMONTOOLS_BUILD_HOST;
 #endif
-  PrintOut(LOG_INFO,"smartd version %s [%s] Copyright (C) 2002-6 Bruce Allen\n", PACKAGE_VERSION, ver);
+  PrintOut(LOG_INFO,"smartd version %s [%s] Copyright (C) 2002-7 Bruce Allen\n", PACKAGE_VERSION, ver);
   PrintOut(LOG_INFO,"Home page is " PACKAGE_HOMEPAGE "\n\n");
   return;
 }
@@ -1133,7 +1136,7 @@ void Directives() {
            "  -v N,ST Modifies labeling of Attribute N (see man page)  \n"
            "  -P TYPE Drive-specific presets: use, ignore, show, showall\n"
            "  -a      Default: -H -f -t -l error -l selftest -C 197 -U 198\n"
-           "  -F TYPE Firmware bug workaround: none, samsung, samsung2\n"
+           "  -F TYPE Firmware bug workaround: none, samsung, samsung2, samsung3\n"
            "   #      Comment: text after a hash sign is ignored\n"
            "   \\      Line continuation character\n"
            "Attribute ID is a decimal integer 1 <= ID <= 255\n"
@@ -1186,24 +1189,23 @@ void Usage (void){
 #else
   PrintOut(LOG_INFO,"        Log to \"./smartd.log\", stdout, stderr [default is event log]\n\n");
 #endif
+#ifndef _WIN32
+  PrintOut(LOG_INFO,"  -n, --no-fork\n");
+  PrintOut(LOG_INFO,"        Do not fork into background\n\n");
+#endif  // _WIN32
   PrintOut(LOG_INFO,"  -p NAME, --pidfile=NAME\n");
   PrintOut(LOG_INFO,"        Write PID file NAME\n\n");
   PrintOut(LOG_INFO,"  -q WHEN, --quit=WHEN\n");
   PrintOut(LOG_INFO,"        Quit on one of: %s\n\n", GetValidArgList('q'));
   PrintOut(LOG_INFO,"  -r, --report=TYPE\n");
   PrintOut(LOG_INFO,"        Report transactions for one of: %s\n\n", GetValidArgList('r'));
-#if defined(_WIN32) || defined(__CYGWIN__)
+#ifdef _WIN32
   PrintOut(LOG_INFO,"  --service\n");
   PrintOut(LOG_INFO,"        Running as windows service (see man page), install with:\n");
-#ifdef _WIN32
   PrintOut(LOG_INFO,"          smartd install [options]\n");
   PrintOut(LOG_INFO,"        Remove service with:\n");
   PrintOut(LOG_INFO,"          smartd remove\n\n");
 #else
-  PrintOut(LOG_INFO,"          /etc/rc.d/init.d/smartd install [options]\n");
-  PrintOut(LOG_INFO,"        Remove service with:\n");
-  PrintOut(LOG_INFO,"          /etc/rc.d/init.d/smartd remove\n\n");
-#endif
 #endif // _WIN32 || __CYGWIN__
   PrintOut(LOG_INFO,"  -V, --version, --license, --copyright\n");
   PrintOut(LOG_INFO,"        Print License, Copyright, and version information\n");
@@ -1214,6 +1216,7 @@ void Usage (void){
   PrintOut(LOG_INFO,"  -h         Display this help and exit\n");
   PrintOut(LOG_INFO,"  -i N       Set interval between disk checks to N seconds, where N >= 10\n");
   PrintOut(LOG_INFO,"  -l local?  Use syslog facility local0 - local7, or daemon\n");
+  PrintOut(LOG_INFO,"  -n         Do not fork into background\n");
   PrintOut(LOG_INFO,"  -p NAME    Write PID file NAME\n");
   PrintOut(LOG_INFO,"  -q WHEN    Quit on one of: %s\n", GetValidArgList('q'));
   PrintOut(LOG_INFO,"  -r TYPE    Report transactions for one of: %s\n", GetValidArgList('r'));
@@ -2041,7 +2044,7 @@ void PrintTestSchedule(cfgfile **atadevices, cfgfile **scsidevices){
   // FixGlibcTimeZoneBug(); // done in PrintOut()
   now=time(NULL);
   dateandtimezoneepoch(datenow, now);
-  for (seconds=0; seconds<3600L*24*90; seconds+=checktime) {
+  for (seconds=checktime; seconds<3600L*24*90; seconds+=checktime) {
     // Check for each device whether a test will be run
     time_t testtime = now + seconds;
     for (i=0; i<numdev; i++) {
@@ -2187,9 +2190,14 @@ int DoATASelfTest(int fd, cfgfile *cfg, char testtype) {
   
   // If currently running a self-test, do not interrupt it to start another.
   if (15==(data.self_test_exec_status >> 4)) {
-    PrintOut(LOG_INFO, "Device: %s, skip scheduled %sTest; %1d0%% remaining of current Self-Test.\n",
-             name, testname, (int)(data.self_test_exec_status & 0x0f));
-    return 1;
+    if (cfg->fixfirmwarebug == FIX_SAMSUNG3 && data.self_test_exec_status == 0xf0) {
+      PrintOut(LOG_INFO, "Device: %s, will not skip scheduled %sTest "
+               "despite unclear Self-Test byte (SAMSUNG Firmware bug).\n", name, testname);
+    } else {
+      PrintOut(LOG_INFO, "Device: %s, skip scheduled %sTest; %1d0%% remaining of current Self-Test.\n",
+               name, testname, (int)(data.self_test_exec_status & 0x0f));
+      return 1;
+    }
   }
 
   // else execute the test, and return status
@@ -2253,7 +2261,7 @@ static void CheckTemperature(cfgfile * cfg, unsigned char currtemp, unsigned cha
   }
 }
 
-int ATACheckDevice(cfgfile *cfg){
+int ATACheckDevice(cfgfile *cfg, bool allow_selftests){
   int fd,i;
   char *name=cfg->name;
   char *mode="ATA";
@@ -2264,6 +2272,10 @@ int ATACheckDevice(cfgfile *cfg){
   con->controller_port=cfg->controller_port;
   con->controller_type=cfg->controller_type;
   con->controller_explicit=cfg->controller_explicit;
+  // Highpoint-specific data
+  con->hpt_data[0]=cfg->hpt_data[0];
+  con->hpt_data[1]=cfg->hpt_data[1];
+  con->hpt_data[2]=cfg->hpt_data[2];
 
   // If user has asked, test the email warning system
   if (cfg->mailwarn && cfg->mailwarn->emailtest)
@@ -2288,7 +2300,7 @@ int ATACheckDevice(cfgfile *cfg){
   // sure) check whether a self test should be done now.
   // This check is done before powermode check to avoid missing self
   // tests on idle or sleeping disks.
-  if (cfg->testdata) {
+  if (allow_selftests && cfg->testdata) {
     // long test
     if (!cfg->testdata->not_cap_long && DoTestNow(cfg, 'L', 0)>0)
       testtype = 'L';
@@ -2537,7 +2549,7 @@ int ATACheckDevice(cfgfile *cfg){
   return 0;
 }
 
-int SCSICheckDevice(cfgfile *cfg)
+int SCSICheckDevice(cfgfile *cfg, bool allow_selftests)
 {
     UINT8 asc, ascq;
     UINT8 currenttemp;
@@ -2607,7 +2619,7 @@ int SCSICheckDevice(cfgfile *cfg)
     if (cfg->selftest)
       CheckSelfTestLogs(cfg, scsiCountFailedSelfTests(fd, 0));
     
-    if (cfg->testdata) {
+    if (allow_selftests && cfg->testdata) {
       // long (extended) background test
       if (!cfg->testdata->not_cap_long && DoTestNow(cfg, 'L', 0)>0)
         DoSCSISelfTest(fd, cfg, 'L');
@@ -2620,14 +2632,14 @@ int SCSICheckDevice(cfgfile *cfg)
 }
 
 // Checks the SMART status of all ATA and SCSI devices
-void CheckDevicesOnce(cfgfile **atadevices, cfgfile **scsidevices){
+void CheckDevicesOnce(cfgfile **atadevices, cfgfile **scsidevices, bool allow_selftests){
   int i;
   
   for (i=0; i<numdevata; i++) 
-    ATACheckDevice(atadevices[i]);
+    ATACheckDevice(atadevices[i], allow_selftests);
   
   for (i=0; i<numdevscsi; i++)
-    SCSICheckDevice(scsidevices[i]);
+    SCSICheckDevice(scsidevices[i], allow_selftests);
 
   return;
 }
@@ -2788,7 +2800,7 @@ void printoutvaliddirectiveargs(int priority, char d) {
     PrintOut(priority, "use, ignore, show, showall");
     break;
   case 'F':
-    PrintOut(priority, "none, samsung, samsung2");
+    PrintOut(priority, "none, samsung, samsung2, samsung3");
     break;
   }
 }
@@ -3038,8 +3050,8 @@ int ParseToken(char *token,cfgfile *cfg){
               PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N requires N integer\n",
                               configfile, lineno, name);
               badarg=1;
-          } else if ( i<0 || i>15) {
-              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N (N=%d) must have 0 <= N <= 15\n",
+          } else if ( i<0 || i>31) {
+              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d 3ware,N (N=%d) must have 0 <= N <= 31\n",
                        configfile, lineno, name, i);
               badarg=1;
           } else {
@@ -3056,8 +3068,8 @@ int ParseToken(char *token,cfgfile *cfg){
               PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d cciss,N requires N integer\n",
                               configfile, lineno, name);
               badarg=1;
-          } else if ( i<0 || i>15) {
-              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d cciss,N (N=%d) must have 0 <= N <= 15\n",
+          } else if ( i<0 || i>127) {
+              PrintOut(LOG_CRIT, "File %s line %d (drive %s): Directive -d cciss,N (N=%d) must have 0 <= N <= 127\n",
                        configfile, lineno, name, i);
               badarg=1;
           } else {
@@ -3081,6 +3093,8 @@ int ParseToken(char *token,cfgfile *cfg){
       cfg->fixfirmwarebug = FIX_SAMSUNG;
     } else if (!strcmp(arg, "samsung2")) {
       cfg->fixfirmwarebug = FIX_SAMSUNG2;
+    } else if (!strcmp(arg, "samsung3")) {
+      cfg->fixfirmwarebug = FIX_SAMSUNG3;
     } else {
       badarg = 1;
     }
@@ -3198,7 +3212,7 @@ int ParseToken(char *token,cfgfile *cfg){
     // Do a bit of sanity checking and warn user if we think that
     // their regexp is "strange". User probably confused about shell
     // glob(3) syntax versus regular expression syntax regexp(7).
-    if ((int)strlen(arg) != (val=strspn(arg,"0123456789/.-+*|()?^$[]SLCO")))
+    else if ((int)strlen(arg) != (val=strspn(arg,"0123456789/.-+*|()?^$[]SLCO")))
       PrintOut(LOG_INFO,  "File %s line %d (drive %s): warning, character %d (%c) looks odd in extended regular expression %s\n",
                configfile, lineno, name, val+1, arg[val], arg);
     break;
@@ -3781,7 +3795,7 @@ void ParseOpts(int argc, char **argv){
   char *tailptr;
   long lchecktime;
   // Please update GetValidArgList() if you edit shortopts
-  const char *shortopts = "c:l:q:dDi:p:r:Vh?";
+  const char *shortopts = "c:l:q:dDni:p:r:Vh?";
 #ifdef HAVE_GETOPT_LONG
   char *arg;
   // Please update GetValidArgList() if you edit longopts
@@ -3792,10 +3806,13 @@ void ParseOpts(int argc, char **argv){
     { "debug",          no_argument,       0, 'd' },
     { "showdirectives", no_argument,       0, 'D' },
     { "interval",       required_argument, 0, 'i' },
+#ifndef _WIN32
+    { "no-fork",        no_argument,       0, 'n' },
+#endif
     { "pidfile",        required_argument, 0, 'p' },
     { "report",         required_argument, 0, 'r' },
 #if defined(_WIN32) || defined(__CYGWIN__)
-    { "service",        no_argument,       0, 'S' },
+    { "service",        no_argument,       0, 'n' },
 #endif
     { "version",        no_argument,       0, 'V' },
     { "license",        no_argument,       0, 'V' },
@@ -3867,6 +3884,12 @@ void ParseOpts(int argc, char **argv){
       // enable debug mode
       debugmode = TRUE;
       break;
+    case 'n':
+      // don't fork()
+#ifndef _WIN32 // On Windows, --service is already handled by daemon_main()
+      do_fork = false;
+#endif
+      break;
     case 'D':
       // print summary of all valid directives
       debugmode = TRUE;
@@ -3931,14 +3954,6 @@ void ParseOpts(int argc, char **argv){
       // output file with PID number
       pid_file=CustomStrDup(optarg, 1, __LINE__,filenameandversion);
       break;
-#if defined(_WIN32) || defined(__CYGWIN__)
-    case 'S':
-      // running as service
-#ifdef __CYGWIN__ // On Windows, option is already handled by daemon_main(), so ignore it
-      is_service = 1;
-#endif
-      break;
-#endif // _WIN32 || __CYGWIN__
     case 'V':
       // print version and CVS info
       PrintCopyleft();
@@ -4148,7 +4163,14 @@ int ReadOrMakeConfigEntries(int *scanning){
     } else if (first->controller_type==CONTROLLER_SAT) {
       doata = 0;
       doscsi = 0;
-    }
+    } else
+      dosat = 0;
+// The code in this block has been neutered by D. Gilbert
+// on 20070226. smartd can't cope ATA disk behind a SAT
+// transport seamlessly _without_ a bigger restructuring
+// of smartd than this code tried. It made ATA disks
+// behind a SAT interface automatically detected only by
+// killing support for real SCSI disks. Sorry, no.
 
     *scanning=1;
     
@@ -4391,8 +4413,9 @@ static int smartd_main(int argc, char **argv)
       caughtsigHUP=0;
     }
 
-    // check all devices once
-    CheckDevicesOnce(atadevlist, scsidevlist); 
+    // check all devices once,
+    // self tests are not started in first pass unless '-q onecheck' is specified
+    CheckDevicesOnce(atadevlist, scsidevlist, (!firstpass || quit==3)); 
     
     // user has asked us to exit after first check
     if (quit==3) {
@@ -4403,9 +4426,6 @@ static int smartd_main(int argc, char **argv)
     
     // fork into background if needed
     if (firstpass && !debugmode) {
-#ifdef __CYGWIN__
-     if (!is_service) // don't fork() if running as service via cygrunsrv
-#endif
       DaemonInit();
     }
 
index d58dc3bae933e80ac934ba891df25e38d31a04b9..9b2ca48533efafe76cc8e67102bedf84593cbf02 100755 (executable)
@@ -1,8 +1,8 @@
 #! /bin/sh
 
 # smartmontools init file for smartd
-# Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
-# $Id: smartd.initd.in,v 1.35 2006/10/24 13:29:24 sbrabec Exp $
+# Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+# $Id: smartd.initd.in,v 1.36 2007/11/01 20:53:30 chrfranke Exp $
 
 # For RedHat and cousins:
 # chkconfig: 2345 40 40
@@ -446,7 +446,7 @@ http://smartmontools.sourceforge.net/"
             fi
             echo "Installing service ${smartd_svcname}${smartd_opts+ with options '$smartd_opts'}:"
             cygrunsrv -I "$smartd_svcname" -d "$smartd_svcdisp"  -f "$smartd_svcdesc" $dep \
-              -e CYGWIN="$CYGWIN" -p $SMARTD_BIN -a "--service -p ${PID_FILE}${smartd_opts+ }$smartd_opts"
+              -e CYGWIN="$CYGWIN" -p $SMARTD_BIN -a "-n -p ${PID_FILE}${smartd_opts+ }$smartd_opts"
             RETVAL=$?
             ;;
         remove)
index 3a9129d55e7d50ffac8fc1573bd1c3b9e5df8a57..3b4104f72fe9039acb3f37230f6466b97ef39f36 100644 (file)
@@ -8,7 +8,7 @@ Summary(pt):    smartmontools - para monitorar discos e dispositivos S.M.A.R.T.
 Summary(it):   smartmontools - per monitare dischi e dispositivi S.M.A.R.T.
 Summary(pl):   Monitorowanie i kontrola dysków u¿ywaj±æ S.M.A.R.T.
 Name:          smartmontools
-Version:       5.37
+Version:       5.38
 License:       GPL
 Group:         Applications/System
 Group(de):     Applikationen/System
@@ -38,7 +38,7 @@ Packager:       Bruce Allen <smartmontools-support@lists.sourceforge.net>
 # http://ftp1.sourceforge.net/smartmontools/smartmontools-%{version}-%{release}.tar.gz
 
 # CVS ID of this file is:
-# $Id: smartmontools.spec,v 1.170 2006/12/20 20:39:25 chrfranke Exp $
+# $Id: smartmontools.spec,v 1.171 2006/12/20 21:59:04 chrfranke Exp $
 
 # Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
 # Home page: http://smartmontools.sourceforge.net/
index d5b0a3f7703cb3b23bf854b67dcee3c2690b6a31..b1a2db26870d7748c3be17530476df21b050c9e8 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -44,7 +44,7 @@
 #include "utility.h"
 
 // Any local header files should be represented by a CVSIDX just below.
-const char* utility_c_cvsid="$Id: utility.cpp,v 1.62 2006/08/09 20:40:20 chrfranke Exp $"
+const char* utility_c_cvsid="$Id: utility.cpp,v 1.64 2007/02/03 15:14:14 chrfranke Exp $"
 CONFIG_H_CVSID INT64_H_CVSID UTILITY_H_CVSID;
 
 const char * packet_types[] = {
@@ -517,25 +517,51 @@ static uint64_t strtoull(const char * p, char * * endp, int base)
 // are allowed).  The first long long int is assigned to *start and the second
 // to *stop.  Returns zero if successful and non-zero otherwise.
 int split_selective_arg(char *s, uint64_t *start,
-                        uint64_t *stop)
+                        uint64_t *stop, int *mode)
 {
   char *tailptr;
-
   if (!(s = strchr(s, ',')))
     return 1;
-  if (!isdigit((int)(*++s)))
-    return 1;
-  errno = 0;
-  // Last argument to strtoull (the base) is 0 meaning that decimal is assumed
-  // unless prefixes of "0" (for octal) or "0x"/"0X" (for hex) are used.
-  *start = strtoull(s, &tailptr, 0);
-
-  s = tailptr;
-  if (errno || *s++ != '-')
-    return 1;
-  *stop = strtoull(s, &tailptr, 0);
+  bool add = false;
+  if (!isdigit((int)(*++s))) {
+    *start = *stop = 0;
+    if (!strncmp(s, "redo", 4))
+      *mode = SEL_REDO;
+    else if (!strncmp(s, "next", 4))
+      *mode = SEL_NEXT;
+    else if (!strncmp(s, "cont", 4))
+      *mode = SEL_CONT;
+    else
+      return 1;
+    s += 4;
+    if (!*s)
+      return 0;
+    if (*s != '+')
+      return 1;
+  }
+  else {
+    *mode = SEL_RANGE;
+    errno = 0;
+    // Last argument to strtoull (the base) is 0 meaning that decimal is assumed
+    // unless prefixes of "0" (for octal) or "0x"/"0X" (for hex) are used.
+    *start = strtoull(s, &tailptr, 0);
+    s = tailptr;
+    add = (*s == '+');
+    if (!(!errno && (add || *s == '-')))
+      return 1;
+    if (!strcmp(s, "-max")) {
+      *stop = ~(uint64_t)0; // replaced by max LBA later
+      return 0;
+    }
+  }
+  *stop = strtoull(s+1, &tailptr, 0);
   if (errno || *tailptr != '\0')
     return 1;
+  if (add) {
+    if (*stop > 0)
+      (*stop)--;
+    *stop += *start; // -t select,N+M => -t select,N,(N+M-1)
+  }
   return 0;
 }
 
@@ -580,7 +606,7 @@ void *Calloc(size_t nmemb, size_t size) {
 // A custom version of strdup() that keeps track of how much memory is
 // being allocated. If mustexist is set, it also throws an error if we
 // try to duplicate a NULL string.
-char *CustomStrDup(char *ptr, int mustexist, int whatline, const char* file){
+char *CustomStrDup(const char *ptr, int mustexist, int whatline, const char* file){
   char *tmp;
 
   // report error if ptr is NULL and mustexist is set
index 3c21e289085101f470e6a7e64c3df5e1e7c32732..e6cf2791b8b63cd119018639fbdde9125db13819 100644 (file)
--- a/utility.h
+++ b/utility.h
@@ -3,7 +3,7 @@
  *
  * Home page of code is: http://smartmontools.sourceforge.net
  *
- * Copyright (C) 2002-6 Bruce Allen <smartmontools-support@lists.sourceforge.net>
+ * Copyright (C) 2002-7 Bruce Allen <smartmontools-support@lists.sourceforge.net>
  * Copyright (C) 2000 Michael Cornwell <cornwell@acm.org>
  *
  * This program is free software; you can redistribute it and/or modify
@@ -25,7 +25,7 @@
 #ifndef UTILITY_H_
 #define UTILITY_H_
 
-#define UTILITY_H_CVSID "$Id: utility.h,v 1.47 2006/10/09 11:45:12 guidog Exp $\n"
+#define UTILITY_H_CVSID "$Id: utility.h,v 1.50 2007/07/26 20:58:50 chrfranke Exp $\n"
 
 #include <time.h>
 #include <sys/types.h> // for regex.h (according to POSIX)
@@ -76,8 +76,14 @@ int compileregex(regex_t *compiled, const char *pattern, int cflags);
 int split_report_arg(char *s, int *i);
 // Function for processing -c option in smartctl and smartd
 int split_report_arg2(char *s, int *i);
+
+// Possible values for smartselectivemode
+#define SEL_RANGE            0 // MIN-MAX
+#define SEL_REDO             1 // redo this
+#define SEL_NEXT             2 // do next range
+#define SEL_CONT             3 // redo or next depending of last test status
 // Function for processing -t selective... option in smartctl
-int split_selective_arg(char *s, uint64_t *start, uint64_t *stop);
+int split_selective_arg(char *s, uint64_t *start, uint64_t *stop, int *mode);
 
 
 // Guess device type (ata or scsi) based on device name 
@@ -106,7 +112,7 @@ inline T * FreeNonZero(T * address, int size, int whatline, const char* file)
 // A custom version of strdup() that keeps track of how much memory is
 // being allocated. If mustexist is set, it also throws an error if we
 // try to duplicate a NULL string.
-char *CustomStrDup(char *ptr, int mustexist, int whatline, const char* file);
+char *CustomStrDup(const char *ptr, int mustexist, int whatline, const char* file);
 
 // To help with memory checking.  Use when it is known that address is
 // NOT null.
@@ -187,5 +193,6 @@ void MsecToText(unsigned int msec, char *txt);
 #define CONTROLLER_SAT                         0x08  // SATA device behind a SCSI ATA Translation (SAT) layer
 #define CONTROLLER_HPT                  0x09  // SATA drives behind HighPoint Raid controllers
 #define CONTROLLER_CCISS               0x10  // CCISS controller 
+#define CONTROLLER_PARSEDEV             0x11  // "smartctl -r ataioctl,2 ..." output parser pseudo-device
 
 #endif